[FFmpeg-cvslog] avcodec/mpegaudiodec_template: Make l3_unscale() work with e=0

Michael Niedermayer git at videolan.org
Tue Mar 14 23:50:30 EET 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Mar 13 20:45:09 2017 +0100| [8ebed703f153e979edb2156754c8bdac4d5d6266] | committer: Michael Niedermayer

avcodec/mpegaudiodec_template: Make l3_unscale() work with e=0

Fixes undefined behavior
Fixes: 830/clusterfuzz-testcase-6253175327686656

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/mpegaudiodec_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c
index 88f6272..a5ac581 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -253,7 +253,7 @@ static inline int l3_unscale(int value, int exponent)
 #endif
     if (e > (SUINT)31)
         return 0;
-    m = (m + (1 << (e - 1))) >> e;
+    m = (m + ((1U << e)>>1)) >> e;
 
     return m;
 }



More information about the ffmpeg-cvslog mailing list