diff mbox

[FFmpeg-devel,2/3] avcodec/mlpdec: Fix runtime error: shift exponent -5 is negative

Message ID 20170520210104.4943-2-michael@niedermayer.cc
State Accepted
Commit 42e42af76cff46c4e1a41dd8de992b38880f78be
Headers show

Commit Message

Michael Niedermayer May 20, 2017, 9:01 p.m. UTC
Fixes part of 1708/clusterfuzz-testcase-minimized-5035111957397504

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

Comments

Michael Niedermayer May 22, 2017, 3:51 p.m. UTC | #1
On Sat, May 20, 2017 at 11:01:03PM +0200, Michael Niedermayer wrote:
> Fixes part of 1708/clusterfuzz-testcase-minimized-5035111957397504
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/mlpdec.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

applied

[...]
diff mbox

Patch

diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index eac19a0d5e..c0a23c5f0d 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -861,8 +861,13 @@  static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp,
 
     if (s->param_presence_flags & PARAM_OUTSHIFT)
         if (get_bits1(gbp)) {
-            for (ch = 0; ch <= s->max_matrix_channel; ch++)
+            for (ch = 0; ch <= s->max_matrix_channel; ch++) {
                 s->output_shift[ch] = get_sbits(gbp, 4);
+                if (s->output_shift[ch] < 0) {
+                    avpriv_request_sample(m->avctx, "Negative output_shift");
+                    s->output_shift[ch] = 0;
+                }
+            }
             if (substr == m->max_decoded_substream)
                 m->dsp.mlp_pack_output = m->dsp.mlp_select_pack_output(s->ch_assign,
                                                                        s->output_shift,