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

Submitted by Michael Niedermayer on Oct. 18, 2019, 10:19 p.m.

Details

Message ID 20191018221924.677-1-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer Oct. 18, 2019, 10:19 p.m.
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@niedermayer.cc>
---
 libavcodec/vp3.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

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,