summaryrefslogtreecommitdiff
path: root/libavcodec/mobiclip.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-09-10 23:59:53 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-09-12 15:17:43 +0200
commitbad8b17a3da219777341acafd3e3113ea2477484 (patch)
tree4ec5969d15c22bdf3e3e2df9844dfb6c5e74f2f1 /libavcodec/mobiclip.c
parentca49476ace90ddebc5f92d9d82297f77e528c21e (diff)
avcodec/mobiclip: Check quantizer before table setup
Fixes: index -1 out of bounds for type 'const uint8_t [6][16]' Fixes: out of array read Fixes: shift exponent -21 is negative Fixes: 25422/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5748258226569216 Fixes: shift exponent 8039082 is too large for 32-bit type 'int' Fixes: 25430/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5698567770210304 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/mobiclip.c')
-rw-r--r--libavcodec/mobiclip.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
index d147eddbae..13f0edc89d 100644
--- a/libavcodec/mobiclip.c
+++ b/libavcodec/mobiclip.c
@@ -1323,6 +1323,10 @@ static int mobiclip_decode(AVCodecContext *avctx, void *data,
}
} else {
MotionXY *motion = s->motion;
+ int quantizer = s->quantizer + get_se_golomb(gb);
+
+ if (quantizer < 12 || quantizer > 161)
+ return AVERROR_INVALIDDATA;
memset(motion, 0, s->motion_size);
@@ -1330,7 +1334,7 @@ static int mobiclip_decode(AVCodecContext *avctx, void *data,
frame->key_frame = 0;
s->dct_tab_idx = 0;
- setup_qtables(avctx, s->quantizer + get_se_golomb(gb));
+ setup_qtables(avctx, quantizer);
for (int y = 0; y < avctx->height; y += 16) {
for (int x = 0; x < avctx->width; x += 16) {
int idx;