diff mbox series

[FFmpeg-devel,1/3] avcodec/ffv1dec: Check that num h/v slices is supported

Message ID 20230218231850.20522-1-michael@niedermayer.cc
State Accepted
Commit 8ead0ae68eb64ad325efafd686c434727f3d666a
Headers show
Series [FFmpeg-devel,1/3] avcodec/ffv1dec: Check that num h/v slices is supported | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Feb. 18, 2023, 11:18 p.m. UTC
Fixes: out of array access
Fixes: 55597/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-4898293416329216

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

Comments

Michael Niedermayer Feb. 23, 2023, 10:18 p.m. UTC | #1
On Sun, Feb 19, 2023 at 12:18:48AM +0100, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 55597/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-4898293416329216
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/ffv1dec.c | 5 +++++
>  1 file changed, 5 insertions(+)

will apply patchset

[...]
diff mbox series

Patch

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index d74786cec3..180d24e695 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -475,6 +475,11 @@  static int read_extra_header(FFV1Context *f)
         return AVERROR_INVALIDDATA;
     }
 
+    if (f->num_h_slices > MAX_SLICES / f->num_v_slices) {
+        av_log(f->avctx, AV_LOG_ERROR, "slice count unsupported\n");
+        return AVERROR_PATCHWELCOME;
+    }
+
     f->quant_table_count = get_symbol(c, state, 0);
     if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || !f->quant_table_count) {
         av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", f->quant_table_count);