avcodec/mpegaudioenc: prevent overflow in fixed point code

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-11-17 21:14:15 +01:00
parent b382d09d29
commit 9f630e8346
1 changed files with 2 additions and 0 deletions

View File

@ -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)