aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-05-16 12:00:18 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-11 20:18:45 +0100
commit7c6bc6c84ca52ba1c5de71ce55a7b378dc9b521a (patch)
tree019aa27847184740641f19a3ee0c992343a27f48 /libavcodec
parentcf372260d8e70c371416c392cc73799343ad6977 (diff)
downloadffmpeg-7c6bc6c84ca52ba1c5de71ce55a7b378dc9b521a.tar.gz
avcodec/aacdec_fixed: Handle more extreem cases in noise_scale()
Its unclear if these cases have any relevance in real files Fixes: shift exponent -2 is negative Fixes: 14489/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5681941631729664 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 3d14663f8345a84613b1ec041fd65e4a90057320) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/aacdec_fixed.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
index 35425bd468..411d96d5a6 100644
--- a/libavcodec/aacdec_fixed.c
+++ b/libavcodec/aacdec_fixed.c
@@ -221,10 +221,15 @@ static void noise_scale(int *coefs, int scale, int band_energy, int len)
}
else {
s = s + 32;
- round = s ? 1 << (s-1) : 0;
- for (i=0; i<len; i++) {
- out = (int)((int64_t)((int64_t)coefs[i] * c + round) >> s);
- coefs[i] = -out;
+ if (s > 0) {
+ round = 1 << (s-1);
+ for (i=0; i<len; i++) {
+ out = (int)((int64_t)((int64_t)coefs[i] * c + round) >> s);
+ coefs[i] = -out;
+ }
+ } else {
+ for (i=0; i<len; i++)
+ coefs[i] = -(int64_t)coefs[i] * c * (1 << -s);
}
}
}