Commit 15e892aa authored by Michael Niedermayer's avatar Michael Niedermayer

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/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 2bfd0a97
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment