[FFmpeg-devel] [PATCH 3/3] avcodec/ituh263dec: Make the condition for the studio slice start code match between ff_h263_resync() and ff_mpeg4_decode_studio_slice_header()
Michael Niedermayer
michael at niedermayer.cc
Sun Sep 15 00:39:50 EEST 2019
If they mismatch an infinite loop can occur
Fixes: Timeout (infinite loop)
Fixes: 17043/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5695051748868096
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/ituh263dec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 1b57e53cad..8bedaac536 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -222,7 +222,7 @@ int ff_h263_resync(MpegEncContext *s){
get_bits(&s->gb, 8);
}
- if (show_bits_long(&s->gb, 32) == SLICE_START_CODE)
+ if (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) == SLICE_START_CODE)
return get_bits_count(&s->gb);
else
return -1;
--
2.23.0
More information about the ffmpeg-devel
mailing list