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
|
else
|
||||||
q1 = sample >> shift;
|
q1 = sample >> shift;
|
||||||
q1 = (q1 * mult) >> P;
|
q1 = (q1 * mult) >> P;
|
||||||
q[m] = ((q1 + (1 << P)) * steps) >> (P + 1);
|
q1 += 1 << P;
|
||||||
if (q[m] < 0)
|
if (q1 < 0)
|
||||||
q[m] = 0;
|
q1 = 0;
|
||||||
|
q[m] = (unsigned)(q1 * steps) >> (P + 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (q[m] >= steps)
|
if (q[m] >= steps)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user