diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-08-04 04:26:30 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-08-08 20:37:43 +0300 |
commit | 5f44aa14ddb2e09a43db7edb019bd98562c49816 (patch) | |
tree | 2df17e9efd6a3fb99e398add03726aa2cd96e2c5 | |
parent | f236601e29b986a547d68aa3248e06ffbeee1e39 (diff) |
avcodec/aacdec_fixed: fix invalid shift in predict()
Fixes: runtime error: shift exponent -2 is negative
Fixes: 2818/clusterfuzz-testcase-minimized-5062943676825600
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 1e443051b277f73b94a2f660d3fd31a1a7beab52)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/aacdec_fixed.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c index 60f4116d76..8f2fcd214b 100644 --- a/libavcodec/aacdec_fixed.c +++ b/libavcodec/aacdec_fixed.c @@ -304,8 +304,12 @@ static av_always_inline void predict(PredictorState *ps, int *coef, if (output_enable) { int shift = 28 - pv.exp; - if (shift < 31) - *coef += (pv.mant + (1 << (shift - 1))) >> shift; + if (shift < 31) { + if (shift > 0) { + *coef += (pv.mant + (1 << (shift - 1))) >> shift; + } else + *coef += pv.mant << -shift; + } } e0 = av_int2sf(*coef, 2); |