diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-11-17 22:58:27 +0100 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-12-11 00:04:04 +0100 |
commit | a9c20e922cee435c9ad2dc78f6c50651f353329c (patch) | |
tree | eeb2f1d98847a147491d29b99c56be9a18eecb1a /libavcodec/sbrdsp_fixed.c | |
parent | ff8816f7172b94028131ee2426ba35e875d973ae (diff) | |
download | ffmpeg-a9c20e922cee435c9ad2dc78f6c50651f353329c.tar.gz |
sbrdsp_fixed: assert that input values are in the valid range
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavcodec/sbrdsp_fixed.c')
-rw-r--r-- | libavcodec/sbrdsp_fixed.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/sbrdsp_fixed.c b/libavcodec/sbrdsp_fixed.c index 5b7b7a6f9b..f4e3de0c71 100644 --- a/libavcodec/sbrdsp_fixed.c +++ b/libavcodec/sbrdsp_fixed.c @@ -38,9 +38,14 @@ static SoftFloat sbr_sum_square_c(int (*x)[2], int n) int i, nz, round; 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]; + av_assert2(FFABS(x[i + 0][1]) >> 29 == 0); 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]; + av_assert2(FFABS(x[i + 1][1]) >> 29 == 0); accu += (int64_t)x[i + 1][1] * x[i + 1][1]; } |