comparison ra144.c @ 11146:e8461dae9672 libavcodec

Fix reading beyond buffer end on RA144Context.lpc_tables. Patch by Francesco Lavra (francescolavra -at- interfree -dot- it)
author vitor
date Sat, 13 Feb 2010 17:42:58 +0000
parents 816067b00019
children 421c9441c11e
comparison
equal deleted inserted replaced
11145:8805efb4c3fd 11146:e8461dae9672
217 217
218 static void int_to_int16(int16_t *out, const int *inp) 218 static void int_to_int16(int16_t *out, const int *inp)
219 { 219 {
220 int i; 220 int i;
221 221
222 for (i=0; i < 30; i++) 222 for (i=0; i < 10; i++)
223 *out++ = *inp++; 223 *out++ = *inp++;
224 } 224 }
225 225
226 /** 226 /**
227 * Evaluate the reflection coefficients from the filter coefficients. 227 * Evaluate the reflection coefficients from the filter coefficients.
274 int b = NBLOCKS - a; 274 int b = NBLOCKS - a;
275 int i; 275 int i;
276 276
277 // Interpolate block coefficients from the this frame's forth block and 277 // Interpolate block coefficients from the this frame's forth block and
278 // last frame's forth block. 278 // last frame's forth block.
279 for (i=0; i<30; i++) 279 for (i=0; i<10; i++)
280 out[i] = (a * ractx->lpc_coef[0][i] + b * ractx->lpc_coef[1][i])>> 2; 280 out[i] = (a * ractx->lpc_coef[0][i] + b * ractx->lpc_coef[1][i])>> 2;
281 281
282 if (eval_refl(work, out, ractx->avctx)) { 282 if (eval_refl(work, out, ractx->avctx)) {
283 // The interpolated coefficients are unstable, copy either new or old 283 // The interpolated coefficients are unstable, copy either new or old
284 // coefficients. 284 // coefficients.
295 { 295 {
296 const uint8_t *buf = avpkt->data; 296 const uint8_t *buf = avpkt->data;
297 int buf_size = avpkt->size; 297 int buf_size = avpkt->size;
298 static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; 298 static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};
299 unsigned int refl_rms[4]; // RMS of the reflection coefficients 299 unsigned int refl_rms[4]; // RMS of the reflection coefficients
300 uint16_t block_coefs[4][30]; // LPC coefficients of each sub-block 300 uint16_t block_coefs[4][10]; // LPC coefficients of each sub-block
301 unsigned int lpc_refl[10]; // LPC reflection coefficients of the frame 301 unsigned int lpc_refl[10]; // LPC reflection coefficients of the frame
302 int i, j; 302 int i, j;
303 int16_t *data = vdata; 303 int16_t *data = vdata;
304 unsigned int energy; 304 unsigned int energy;
305 305