[FFmpeg-cvslog] avcodec/diracdec: Check weight_log2denom

Michael Niedermayer git at videolan.org
Sun Sep 17 13:54:52 EEST 2017


ffmpeg | branch: release/3.2 | Michael Niedermayer <michael at niedermayer.cc> | Sat Jul 29 15:46:50 2017 +0200| [892ceb512f0f10f6cdb7edb4446efbb0ae5b94ed] | committer: Michael Niedermayer

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 at niedermayer.cc>
(cherry picked from commit 880f5c59139e1d85d3a0b3433103f3fea17ff2d3)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=892ceb512f0f10f6cdb7edb4446efbb0ae5b94ed
---

 libavcodec/diracdec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index bc0eb90ab1..bd4ea845ca 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -1173,6 +1173,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);



More information about the ffmpeg-cvslog mailing list