Commit f8060ab9 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/wavpack: Check value before shift in wp_exp2()

Fixes undefined shift, all callers should be changed to check the value
they use with wp_exp2() or its return value.

Fixes: 692/clusterfuzz-testcase-5757381516460032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 12c3e120
...@@ -171,6 +171,8 @@ static av_always_inline int wp_exp2(int16_t val) ...@@ -171,6 +171,8 @@ static av_always_inline int wp_exp2(int16_t val)
res = wp_exp2_table[val & 0xFF] | 0x100; res = wp_exp2_table[val & 0xFF] | 0x100;
val >>= 8; val >>= 8;
if (val > 31)
return INT_MIN;
res = (val > 9) ? (res << (val - 9)) : (res >> (9 - val)); res = (val > 9) ? (res << (val - 9)) : (res >> (9 - val));
return neg ? -res : res; return neg ? -res : res;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment