From 3d5e1bfb20d3489d7bb2fa26196e02086e06f2b8 Mon Sep 17 00:00:00 2001 From: Jai Menon Date: Fri, 5 Dec 2008 07:58:31 +0000 Subject: [PATCH] Fix an overflow in the predictor. fixes issue 636 Patch by Jai. Originally committed as revision 16007 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/alacenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c index df4136f4c4..9fd5064514 100644 --- a/libavcodec/alacenc.c +++ b/libavcodec/alacenc.c @@ -253,7 +253,8 @@ static void alac_linear_predictor(AlacEncodeContext *s, int ch) sum >>= lpc.lpc_quant; sum += samples[0]; - residual[i] = samples[lpc.lpc_order+1] - sum; + residual[i] = (samples[lpc.lpc_order+1] - sum) << (32 - s->write_sample_size) >> + (32 - s->write_sample_size); res_val = residual[i]; if(res_val) {