aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-07-29 15:46:50 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-08-01 14:13:31 +0200
commit6d849e2706d04588d16ee65dacea21f24f30d9d4 (patch)
tree567e3f95b67bcf31d321dcab3f09599ea65cca0d
parentacedc53186c4c9564d3b6442bb293ffc4d7b7f8b (diff)
downloadffmpeg-6d849e2706d04588d16ee65dacea21f24f30d9d4.tar.gz
avcodec/diracdec: Check weight_log2denom
Fixes: runtime error: shift exponent -1 is negative Fixes: 2742/clusterfuzz-testcase-minimized-5724322402402304 Fixes: 2744/clusterfuzz-testcase-minimized-4672435653705728 Fixes: 2749/clusterfuzz-testcase-minimized-5298741273690112 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 880f5c59139e1d85d3a0b3433103f3fea17ff2d3) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/diracdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 42518c2681..579ff97322 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -1100,6 +1100,11 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
if (get_bits1(gb)) {
s->weight_log2denom = get_interleaved_ue_golomb(gb);
+ if (s->weight_log2denom < 1 || s->weight_log2denom > 8) {
+ av_log(s->avctx, AV_LOG_ERROR, "weight_log2denom unsupported or invalid\n");
+ s->weight_log2denom = 1;
+ return AVERROR_INVALIDDATA;
+ }
s->weight[0] = dirac_get_se_golomb(gb);
if (s->num_refs == 2)
s->weight[1] = dirac_get_se_golomb(gb);