aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-02-21 01:09:43 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-03-14 00:24:44 +0100
commit4e624c89fddd90907609a0cc907040204ad67468 (patch)
treebaea3659d9164919dd1b7392b3d1163a70f7337a
parent9495228df0288e61f9fa8ebb8ba86c14223aa949 (diff)
downloadffmpeg-4e624c89fddd90907609a0cc907040204ad67468.tar.gz
avcodec/jvdec: Check available input space before decode8x8()
Fixes: Timeout (78 sec -> 15 millisec) Fixes: 13147/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JV_fuzzer-5727107827630080 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 61523683c5a9bda9aaa7ae24764a3df0401a9877) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/jvdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index cbe83d3c10..4337d5681e 100644
--- a/libavcodec/jvdec.c
+++ b/libavcodec/jvdec.c
@@ -170,6 +170,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
GetBitContext gb;
init_get_bits(&gb, buf, 8 * video_size);
+ if (avctx->height/8 * (avctx->width/8) > 4 * video_size) {
+ av_log(avctx, AV_LOG_ERROR, "Insufficient input data for dimensions\n");
+ return AVERROR_INVALIDDATA;
+ }
+
for (j = 0; j < avctx->height; j += 8)
for (i = 0; i < avctx->width; i += 8)
decode8x8(&gb,