Browse Source

imc: sanity check scalefactors.

This fixes undefined behavior

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n1.1
Michael Niedermayer 13 years ago
parent
commit
2f74f8d7dc
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      libavcodec/imc.c

+ 7
- 0
libavcodec/imc.c View File

@@ -805,6 +805,13 @@ static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch)
imc_decode_level_coefficients2(q, chctx->levlCoeffBuf, chctx->old_floor,
chctx->flcoeffs1, chctx->flcoeffs2);

for(i=0; i<BANDS; i++) {
if(chctx->flcoeffs1[i] > INT_MAX) {
av_log(avctx, AV_LOG_ERROR, "scalefactor out of range\n");
return AVERROR_INVALIDDATA;
}
}

memcpy(chctx->old_floor, chctx->flcoeffs1, 32 * sizeof(float));

counter = 0;


Loading…
Cancel
Save