# HG changeset patch # User vitor # Date 1262708741 0 # Node ID 816067b00019478d1f1f7467d853ce03c4a6b8d5 # Parent 35e175942ee245abfb45b724a6b4a653909a42e6 Use correct context for av_log(), should prevent a crash for malformed files. Patch by Francesco Lavra (francescolavra at interfree dot it). diff -r 35e175942ee2 -r 816067b00019 ra144.c --- a/ra144.c Tue Jan 05 10:18:01 2010 +0000 +++ b/ra144.c Tue Jan 05 16:25:41 2010 +0000 @@ -33,6 +33,8 @@ typedef struct { + AVCodecContext *avctx; + unsigned int old_energy; ///< previous frame energy unsigned int lpc_tables[2][10]; @@ -55,6 +57,8 @@ { RA144Context *ractx = avctx->priv_data; + ractx->avctx = avctx; + ractx->lpc_coef[0] = ractx->lpc_tables[0]; ractx->lpc_coef[1] = ractx->lpc_tables[1]; @@ -226,7 +230,7 @@ * @return 1 if one of the reflection coefficients is greater than * 4095, 0 if not. */ -static int eval_refl(int *refl, const int16_t *coefs, RA144Context *ractx) +static int eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx) { int b, i, j; int buffer1[10]; @@ -240,7 +244,7 @@ refl[9] = bp2[9]; if ((unsigned) bp2[9] + 0x1000 > 0x1fff) { - av_log(ractx, AV_LOG_ERROR, "Overflow. Broken sample?\n"); + av_log(avctx, AV_LOG_ERROR, "Overflow. Broken sample?\n"); return 1; } @@ -275,7 +279,7 @@ for (i=0; i<30; i++) out[i] = (a * ractx->lpc_coef[0][i] + b * ractx->lpc_coef[1][i])>> 2; - if (eval_refl(work, out, ractx)) { + if (eval_refl(work, out, ractx->avctx)) { // The interpolated coefficients are unstable, copy either new or old // coefficients. int_to_int16(out, ractx->lpc_coef[copyold]);