summaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-17 11:54:12 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-10-19 18:20:44 +0200
commit2c78a76cb0443f8a12a5eadc3b58373aa2f4ab22 (patch)
treed11a3e9537b4a4e6e6d460b342adcfdaa1767a51 /libavcodec
parent5f0acc5064ed501cb40d4aaccae2b3ce5c4552fd (diff)
downloadffmpeg-streaming-2c78a76cb0443f8a12a5eadc3b58373aa2f4ab22.zip
ffmpeg-streaming-2c78a76cb0443f8a12a5eadc3b58373aa2f4ab22.tar.gz
avcodec/g729dec: Avoid computing invalid temporary pointers for ff_acelp_weighted_vector_sum()
Fixes: Ticket8176 Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/g729dec.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c
index 2595171..67054b7 100644
--- a/libavcodec/g729dec.c
+++ b/libavcodec/g729dec.c
@@ -557,12 +557,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
fc_v[i] = <
\ fc_v[i] + gain_pitch * fc_v[i-pitch_delay], i >= pitch_delay
*/
- ff_acelp_weighted_vector_sum(fc + pitch_delay_int[i],
- fc + pitch_delay_int[i],
- fc, 1 << 14,
- av_clip(ctx->past_gain_pitch[0], SHARP_MIN, SHARP_MAX),
- 0, 14,
- SUBFRAME_SIZE - pitch_delay_int[i]);
+ if (SUBFRAME_SIZE > pitch_delay_int[i])
+ ff_acelp_weighted_vector_sum(fc + pitch_delay_int[i],
+ fc + pitch_delay_int[i],
+ fc, 1 << 14,
+ av_clip(ctx->past_gain_pitch[0], SHARP_MIN, SHARP_MAX),
+ 0, 14,
+ SUBFRAME_SIZE - pitch_delay_int[i]);
memmove(ctx->past_gain_pitch+1, ctx->past_gain_pitch, 5 * sizeof(int16_t));
ctx->past_gain_code[1] = ctx->past_gain_code[0];
OpenPOWER on IntegriCloud