diff mbox

[FFmpeg-devel,4/7] avcodec/alsdec: Fix invalid shift in multiply()

Message ID 20190620224721.8480-4-michael@niedermayer.cc
State Accepted
Commit f30be1ec9856551d96f3876eec5f8b8abf456b81
Headers show

Commit Message

Michael Niedermayer June 20, 2019, 10:47 p.m. UTC
Fixes: shift exponent -24 is negative
Fixes: 15292/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5768533318828032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/alsdec.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Niedermayer June 26, 2019, 7:32 p.m. UTC | #1
On Fri, Jun 21, 2019 at 12:47:18AM +0200, Michael Niedermayer wrote:
> Fixes: shift exponent -24 is negative
> Fixes: 15292/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5768533318828032
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/alsdec.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 8e0d3e5f83..4e5d5fd143 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1385,6 +1385,9 @@  static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) {
     mantissa_temp = (uint64_t)a.mant * (uint64_t)b.mant;
     mask_64       = (uint64_t)0x1 << 47;
 
+    if (!mantissa_temp)
+        return FLOAT_0;
+
     // Count the valid bit count
     while (!(mantissa_temp & mask_64) && mask_64) {
         bit_count--;