aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-14 18:31:40 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-11 20:18:47 +0100
commit4757369c3fb5d67b9cecf15d62855b4d11e209c8 (patch)
tree52e2f6aadcdccd13dfe337f137d5068c2659f113
parentd5a3e17d29d9b496c700941481647f31590320d0 (diff)
downloadffmpeg-4757369c3fb5d67b9cecf15d62855b4d11e209c8.tar.gz
avcodec/ituh263dec: Make the condition for the studio slice start code match between ff_h263_resync() and ff_mpeg4_decode_studio_slice_header()
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@niedermayer.cc> (cherry picked from commit 8335ba8ae99941422bef0e16ea8cf1ebe2e9a7b3) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/ituh263dec.c2
1 files changed, 1 insertions, 1 deletions
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;