[FFmpeg-cvslog] avcodec/aacdec_fixed: fix invalid shift in predict()
Michael Niedermayer
git at videolan.org
Sun Sep 10 03:10:12 EEST 2017
ffmpeg | branch: release/3.3 | Michael Niedermayer <michael at niedermayer.cc> | Fri Aug 4 03:26:30 2017 +0200| [818f73542daf9a125b58e284f5ae3c9b35721f5c] | committer: Michael Niedermayer
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 at niedermayer.cc>
(cherry picked from commit 1e443051b277f73b94a2f660d3fd31a1a7beab52)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=818f73542daf9a125b58e284f5ae3c9b35721f5c
---
libavcodec/aacdec_fixed.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
index ccc82057e1..e7c2d2d299 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);
More information about the ffmpeg-cvslog
mailing list