aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-17 21:14:15 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-17 21:14:15 +0100
commit9f630e8346707c093ac47cbe04384ab89ecd693a (patch)
tree63cdfff70c161fbb995acaed79ad6d01802e2f61
parentb382d09d29be90e0947295a70cdcbaa60b9030b8 (diff)
downloadffmpeg-9f630e8346707c093ac47cbe04384ab89ecd693a.tar.gz
avcodec/mpegaudioenc: prevent overflow in fixed point code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mpegaudioenc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c
index 005401946e..133c9dcc1d 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)