[FFmpeg-cvslog] avcodec/mobiclip: Check input size before (re)allocation

Michael Niedermayer git at videolan.org
Mon Nov 28 22:32:35 EET 2022


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Nov 18 20:54:12 2022 +0100| [93810a625cb7d0dc174576951519ce72321c9f66] | committer: Michael Niedermayer

avcodec/mobiclip: Check input size before (re)allocation

Fixes: Timeout
Fixes: 52566/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-4913160050311168

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=93810a625cb7d0dc174576951519ce72321c9f66
---

 libavcodec/mobiclip.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
index aca462428c..c3b2383dbc 100644
--- a/libavcodec/mobiclip.c
+++ b/libavcodec/mobiclip.c
@@ -1216,6 +1216,9 @@ static int mobiclip_decode(AVCodecContext *avctx, AVFrame *rframe,
     AVFrame *frame = s->pic[s->current_pic];
     int ret;
 
+    if (avctx->height/16 * (avctx->width/16) * 2 > 8LL*FFALIGN(pkt->size, 2))
+        return AVERROR_INVALIDDATA;
+
     av_fast_padded_malloc(&s->bitstream, &s->bitstream_size,
                           pkt->size);
 



More information about the ffmpeg-cvslog mailing list