This check is not based on the specification, which allows instead arbitrary 
croping

Fixes: Timeout (32sec -> 0.1sec)
Fixes: 
18207/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-5666242274263040

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
---
 libavcodec/vp3.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index a2bd2ef07d..a28b9b6c6b 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2991,6 +2991,8 @@ static int theora_decode_header(AVCodecContext *avctx, 
GetBitContext *gb)
 
     /* sanity check */
     if (av_image_check_size(visible_width, visible_height, 0, avctx) < 0 ||
+        visible_width  + offset_x + 256 < s->width ||
+        visible_height + offset_y + 256 < s->height ||
         visible_width  + offset_x > s->width ||
         visible_height + offset_y > s->height) {
         av_log(avctx, AV_LOG_ERROR,
-- 
2.23.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to