summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-01-28 20:12:25 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-02-03 23:59:07 +0100
commitfb3855342b9e4c577c63b38a7a5a574830a21934 (patch)
tree5997ecff7e12c678edb2f384d9ac451084456f67
parent861183f2e655ad5d399a8a23b6b6b48463962c5e (diff)
avcodec/lagarith: Sanity check scale
A value of 24 and above can collaps the range to 0 which would not work. Fixes: Timeout (75sec -> 21sec) Fixes: 18707/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-5708950892969984 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/lagarith.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index 59169be5de..0a45812bc1 100644
--- a/libavcodec/lagarith.c
+++ b/libavcodec/lagarith.c
@@ -226,6 +226,9 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb)
}
}
+ if (scale_factor > 23)
+ return AVERROR_INVALIDDATA;
+
rac->scale = scale_factor;
/* Fill probability array with cumulative probability for each symbol. */