[FFmpeg-cvslog] avcodec/mpegaudioenc: prevent overflow in fixed point code

Michael Niedermayer git at videolan.org
Sun Nov 17 21:33:15 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Nov 17 21:14:15 2013 +0100| [9f630e8346707c093ac47cbe04384ab89ecd693a] | committer: Michael Niedermayer

avcodec/mpegaudioenc: prevent overflow in fixed point code

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/mpegaudioenc.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c
index 0054019..133c9dc 100644
--- a/libavcodec/mpegaudioenc.c
+++ b/libavcodec/mpegaudioenc.c
@@ -704,6 +704,8 @@ static void encode_frame(MpegAudioContext *s,
                                     q1 = sample >> shift;
                                 q1 = (q1 * mult) >> P;
                                 q[m] = ((q1 + (1 << P)) * steps) >> (P + 1);
+                                if (q[m] < 0)
+                                    q[m] = 0;
                             }
 #endif
                             if (q[m] >= steps)



More information about the ffmpeg-cvslog mailing list