[FFmpeg-cvslog] avcodec/alsdec: fix mantisse shift

Michael Niedermayer git at videolan.org
Wed Sep 4 22:25:43 EEST 2019


ffmpeg | branch: release/4.2 | Michael Niedermayer <michael at niedermayer.cc> | Fri Jul 26 17:07:01 2019 +0200| [eda64cda63a6ed33a110f87e6163e58b12a0a288] | committer: Michael Niedermayer

avcodec/alsdec: fix mantisse shift

Fixes: shift exponent -1 is negative
Fixes: 16039/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5656825657032704

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 02346292a334a51f6da802146b782bdb01ae9b4e)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eda64cda63a6ed33a110f87e6163e58b12a0a288
---

 libavcodec/alsdec.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index d4451482a4..e1449a72a5 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1404,7 +1404,11 @@ static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) {
         }
     }
 
-    mantissa = (unsigned int)(mantissa_temp >> cutoff_bit_count);
+    if (cutoff_bit_count >= 0) {
+        mantissa = (unsigned int)(mantissa_temp >> cutoff_bit_count);
+    } else {
+        mantissa = (unsigned int)(mantissa_temp <<-cutoff_bit_count);
+    }
 
     // Need one more shift?
     if (mantissa & 0x01000000ul) {



More information about the ffmpeg-cvslog mailing list