mirror of https://git.ffmpeg.org/ffmpeg.git
sbrdsp_fixed: assert that input values are in the valid range
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
parent
ff8816f717
commit
a9c20e922c
|
@ -38,9 +38,14 @@ static SoftFloat sbr_sum_square_c(int (*x)[2], int n)
|
||||||
int i, nz, round;
|
int i, nz, round;
|
||||||
|
|
||||||
for (i = 0; i < n; i += 2) {
|
for (i = 0; i < n; i += 2) {
|
||||||
|
// Larger values are inavlid and could cause overflows of accu.
|
||||||
|
av_assert2(FFABS(x[i + 0][0]) >> 29 == 0);
|
||||||
accu += (int64_t)x[i + 0][0] * x[i + 0][0];
|
accu += (int64_t)x[i + 0][0] * x[i + 0][0];
|
||||||
|
av_assert2(FFABS(x[i + 0][1]) >> 29 == 0);
|
||||||
accu += (int64_t)x[i + 0][1] * x[i + 0][1];
|
accu += (int64_t)x[i + 0][1] * x[i + 0][1];
|
||||||
|
av_assert2(FFABS(x[i + 1][0]) >> 29 == 0);
|
||||||
accu += (int64_t)x[i + 1][0] * x[i + 1][0];
|
accu += (int64_t)x[i + 1][0] * x[i + 1][0];
|
||||||
|
av_assert2(FFABS(x[i + 1][1]) >> 29 == 0);
|
||||||
accu += (int64_t)x[i + 1][1] * x[i + 1][1];
|
accu += (int64_t)x[i + 1][1] * x[i + 1][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue