aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-11 19:10:16 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-14 12:20:16 +0200
commit54eaad7c6e321dc2ba1cc9e973b4f49d74a3e20a (patch)
treef9bf899d7859e11f0c9c98533032471eec4bc71e
parentaf52a28f4dd2cd536f066e630d618a0405a37b93 (diff)
downloadffmpeg-54eaad7c6e321dc2ba1cc9e973b4f49d74a3e20a.tar.gz
avcodec/msmpeg4dec: Check for cbpy VLC errors
Fixes: runtime error: left shift of negative value -1 Fixes: 1480/clusterfuzz-testcase-minimized-5188321007370240 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 15e892aad12b23e9b5686cf66ca6fa739c734ead) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/msmpeg4dec.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c
index b464092d88..26f292806f 100644
--- a/libavcodec/msmpeg4dec.c
+++ b/libavcodec/msmpeg4dec.c
@@ -169,12 +169,23 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64])
s->mv[0][0][1] = my;
*mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16;
} else {
+ int v;
if(s->msmpeg4_version==2){
s->ac_pred = get_bits1(&s->gb);
- cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors
+ v = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
+ if (v < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "cbpy vlc invalid\n");
+ return -1;
+ }
+ cbp|= v<<2;
} else{
s->ac_pred = 0;
- cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors
+ v = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
+ if (v < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "cbpy vlc invalid\n");
+ return -1;
+ }
+ cbp|= v<<2;
if(s->pict_type==AV_PICTURE_TYPE_P) cbp^=0x3C;
}
*mb_type_ptr = MB_TYPE_INTRA;