Mercurial > libavcodec.hg
comparison aaccoder.c @ 9965:27339a7fee03 libavcodec
Fix an integer overflow in the AAC encoder.
| author | alexc |
|---|---|
| date | Mon, 20 Jul 2009 18:27:17 +0000 |
| parents | c0d721961a7f |
| children | fd487090d901 |
comparison
equal
deleted
inserted
replaced
| 9964:aad612d229b4 | 9965:27339a7fee03 |
|---|---|
| 70 { | 70 { |
| 71 int i; | 71 int i; |
| 72 double qc; | 72 double qc; |
| 73 for (i = 0; i < size; i++) { | 73 for (i = 0; i < size; i++) { |
| 74 qc = scaled[i] * Q34; | 74 qc = scaled[i] * Q34; |
| 75 out[i][0] = (int)FFMIN((int)qc, maxval); | 75 out[i][0] = (int)FFMIN(qc, (double)maxval); |
| 76 out[i][1] = (int)FFMIN((int)(qc + 0.4054), maxval); | 76 out[i][1] = (int)FFMIN(qc + 0.4054, (double)maxval); |
| 77 if (is_signed && in[i] < 0.0f) { | 77 if (is_signed && in[i] < 0.0f) { |
| 78 out[i][0] = -out[i][0]; | 78 out[i][0] = -out[i][0]; |
| 79 out[i][1] = -out[i][1]; | 79 out[i][1] = -out[i][1]; |
| 80 } | 80 } |
| 81 } | 81 } |
