avcodec/h263dec: Check slice_ret in mspeg4 slice loop
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 22 Apr 2018 19:07:45 +0000 (21:07 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 25 Apr 2018 21:09:47 +0000 (23:09 +0200)
Fixes infinite loop
Fixes: 6858/clusterfuzz-testcase-ffmpeg_AV_CODEC_ID_MSMPEG4V3_fuzzer-4681563766784000
Fixes: 6890/clusterfuzz-testcase-ffmpeg_AV_CODEC_ID_WMV1_fuzzer-4756103142309888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/h263dec.c

index 484bf39..eae29fa 100644 (file)
@@ -641,7 +641,7 @@ retry:
     slice_ret = decode_slice(s);
     while (s->mb_y < s->mb_height) {
         if (s->msmpeg4_version) {
-            if (s->slice_height == 0 || s->mb_x != 0 ||
+            if (s->slice_height == 0 || s->mb_x != 0 || slice_ret < 0 ||
                 (s->mb_y % s->slice_height) != 0 || get_bits_left(&s->gb) < 0)
                 break;
         } else {