summaryrefslogtreecommitdiff
path: root/libavcodec/v210dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-12-01 23:26:47 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-12 19:25:33 +0100
commitab3044368f3fc10a3d43718a2bd664be8ce9fdb5 (patch)
tree08213999825fd8dde4f06d7f399f7109c9aa089c /libavcodec/v210dec.c
parent7aef2f59b518defea168cde51c7df0c43408286a (diff)
avcodec/v210dec: move the stride read after its fully initialized
Fixes: out of array read Fixes: 19129/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_V210_fuzzer-5068171023482880 Maybe fixes: 19130/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_V210_fuzzer-5637264407527424 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/v210dec.c')
-rw-r--r--libavcodec/v210dec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c
index 8483023815..044d35338b 100644
--- a/libavcodec/v210dec.c
+++ b/libavcodec/v210dec.c
@@ -153,7 +153,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
int aligned_width = ((avctx->width + 47) / 48) * 48;
stride = aligned_width * 8 / 3;
}
- td.stride = stride;
if (avpkt->size < stride * avctx->height) {
if ((((avctx->width + 23) / 24) * 24 * 8) / 3 * avctx->height == avpkt->size) {
@@ -166,6 +165,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return AVERROR_INVALIDDATA;
}
}
+ td.stride = stride;
if ( avctx->codec_tag == MKTAG('C', '2', '1', '0')
&& avpkt->size > 64
&& AV_RN32(psrc) == AV_RN32("INFO")