diff options
author | Mans Rullgard <mans@mansr.com> | 2012-08-10 01:17:20 +0100 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2012-08-10 12:18:38 +0100 |
commit | 05c36e0e5fbf0b75dbbbd327ad2f6a62992f9262 (patch) | |
tree | 5799d43568ed2422cced6c16f973c3464f9e6b3b | |
parent | 52aa3015a3c895cf74e555c4bb56c08cd067383e (diff) | |
download | ffmpeg-05c36e0e5fbf0b75dbbbd327ad2f6a62992f9262.tar.gz |
g723.1: fix addition overflow
This addition must be done as 64-bit to avoid overflow and for
the subsequent clipping to be meaningful.
Signed-off-by: Mans Rullgard <mans@mansr.com>
-rw-r--r-- | libavcodec/g723_1.c | 2 | ||||
-rw-r--r-- | tests/ref/fate/g723_1-dec-3 | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c index 53b9adedd4..7d8a48e18a 100644 --- a/libavcodec/g723_1.c +++ b/libavcodec/g723_1.c @@ -979,7 +979,7 @@ static void formant_postfilter(G723_1_Context *p, int16_t *lpc, int16_t *buf) /* Compensation filter */ for (j = 0; j < SUBFRAME_LEN; j++) { - buf_ptr[j] = av_clipl_int32(signal_ptr[j] + + buf_ptr[j] = av_clipl_int32((int64_t)signal_ptr[j] + ((signal_ptr[j - 1] >> 16) * temp << 1)) >> 16; } diff --git a/tests/ref/fate/g723_1-dec-3 b/tests/ref/fate/g723_1-dec-3 index eabdd738ce..d1a29464e9 100644 --- a/tests/ref/fate/g723_1-dec-3 +++ b/tests/ref/fate/g723_1-dec-3 @@ -13,7 +13,7 @@ 0, 2640, 2640, 240, 480, 0xe253c7e1 0, 2880, 2880, 240, 480, 0x672cbf0a 0, 3120, 3120, 240, 480, 0x5f32aa27 -0, 3360, 3360, 240, 480, 0x8646a245 +0, 3360, 3360, 240, 480, 0x0b3da147 0, 3600, 3600, 240, 480, 0x4819e5bc 0, 3840, 3840, 240, 480, 0x423dec60 0, 4080, 4080, 240, 480, 0xafefe289 |