diff mbox

[FFmpeg-devel,3/3] avcodec/fic: Fail on invalid slice size/off

Message ID 20181216204307.15575-3-michael@niedermayer.cc
State Accepted
Commit 30a7a81cdc2ee2eac6d3271439c43f11b7327b3e
Headers show

Commit Message

Michael Niedermayer Dec. 16, 2018, 8:43 p.m. UTC
Fixes: Timeout
Fixes: 11486/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FIC_fuzzer-5677133863583744

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

Comments

Michael Niedermayer Dec. 23, 2018, 12:45 p.m. UTC | #1
On Sun, Dec 16, 2018 at 09:43:07PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 11486/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FIC_fuzzer-5677133863583744
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/fic.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply


[...]
diff mbox

Patch

diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index dcf0777674..3e36346358 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -380,6 +380,8 @@  static int fic_decode_frame(AVCodecContext *avctx, void *data,
             slice_h      = FFALIGN(avctx->height - ctx->slice_h * (nslices - 1), 16);
         } else {
             slice_size = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4 + 4);
+            if (slice_size < slice_off)
+                return AVERROR_INVALIDDATA;
         }
 
         if (slice_size < slice_off || slice_size > msize)