aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-02-18 22:33:02 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2023-06-04 20:18:15 +0200
commita928367cba8b732320b0a07d07559ccd0f9f48d0 (patch)
tree9a3bb8b662d26cdc44a0b05aa0ac5e876da874f5
parenta919346b63933c26ac0c713ba951180e09903c57 (diff)
downloadffmpeg-a928367cba8b732320b0a07d07559ccd0f9f48d0.tar.gz
avcodec/ffv1dec: Check that num h/v slices is supported
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> (cherry picked from commit 8ead0ae68eb64ad325efafd686c434727f3d666a) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/ffv1dec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 51d1569ff8..6e23f8799f 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -476,6 +476,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);