aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-27 17:01:38 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:49:26 +0200
commitac28d793c1e8989d2288303589a818d575e739b7 (patch)
tree1a2e575bc8205f1257b8f601417e8c517bce1f8d
parent7c985c6334255bf8994da057d3d24876fadb199c (diff)
downloadffmpeg-ac28d793c1e8989d2288303589a818d575e739b7.tar.gz
avcodec/lsp: Fix undefined shifts in lsp2poly()
Fixes: left shift of negative value -30635 Fixes: 17689/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ACELP_KELVIN_fuzzer-5756275014500352 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 2b93f52cd635f372b7b22396939e840c63e8edf3) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/lsp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/lsp.c b/libavcodec/lsp.c
index 9aba020ebb..fb4da47894 100644
--- a/libavcodec/lsp.c
+++ b/libavcodec/lsp.c
@@ -108,7 +108,7 @@ static void lsp2poly(int* f, const int16_t* lsp, int lp_half_order)
int i, j;
f[0] = 0x400000; // 1.0 in (3.22)
- f[1] = -lsp[0] << 8; // *2 and (0.15) -> (3.22)
+ f[1] = -lsp[0] * 256; // *2 and (0.15) -> (3.22)
for(i=2; i<=lp_half_order; i++)
{
@@ -116,7 +116,7 @@ static void lsp2poly(int* f, const int16_t* lsp, int lp_half_order)
for(j=i; j>1; j--)
f[j] -= MULL(f[j-1], lsp[2*i-2], FRAC_BITS) - f[j-2];
- f[1] -= lsp[2*i-2] << 8;
+ f[1] -= lsp[2*i-2] * 256;
}
}