avcodec/mpegaudioenc_template: reorder operations to prevent integer overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
9d66aa2c8f
commit
44841528c1
@ -700,9 +700,10 @@ static void encode_frame(MpegAudioContext *s,
|
||||
else
|
||||
q1 = sample >> shift;
|
||||
q1 = (q1 * mult) >> P;
|
||||
q[m] = ((q1 + (1 << P)) * steps) >> (P + 1);
|
||||
if (q[m] < 0)
|
||||
q[m] = 0;
|
||||
q1 += 1 << P;
|
||||
if (q1 < 0)
|
||||
q1 = 0;
|
||||
q[m] = (unsigned)(q1 * steps) >> (P + 1);
|
||||
}
|
||||
#endif
|
||||
if (q[m] >= steps)
|
||||
|
Loading…
x
Reference in New Issue
Block a user