[FFmpeg-devel] [PATCH 1/4] avcodec/vp3: sanity check cropping

Michael Niedermayer michael at niedermayer.cc
Sat Oct 19 01:19:21 EEST 2019


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 <michael at 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



More information about the ffmpeg-devel mailing list