summaryrefslogtreecommitdiffstats
path: root/libavcodec/aacdec_fixed.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-08-04 03:26:30 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-08-05 23:56:55 +0200
commit1e443051b277f73b94a2f660d3fd31a1a7beab52 (patch)
tree6fc9a6f5fd787fe48a8d1f7dd2bb2774b324b059 /libavcodec/aacdec_fixed.c
parent1f53bde6d817ae13a47748f321adbdfa79e15982 (diff)
downloadffmpeg-streaming-1e443051b277f73b94a2f660d3fd31a1a7beab52.zip
ffmpeg-streaming-1e443051b277f73b94a2f660d3fd31a1a7beab52.tar.gz
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>
Diffstat (limited to 'libavcodec/aacdec_fixed.c')
-rw-r--r--libavcodec/aacdec_fixed.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
index ccfef7f..f6a5330 100644
--- a/libavcodec/aacdec_fixed.c
+++ b/libavcodec/aacdec_fixed.c
@@ -305,8 +305,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);
OpenPOWER on IntegriCloud