Check if there is enough bytes before reading the buffer in the EA ADPCM

decoder. Fix issue 990.

Originally committed as revision 18707 to svn://svn.ffmpeg.org/ffmpeg/trunk
release/0.6
Vitor Sessak 16 years ago
parent 8a06cb14f9
commit 6cf92f6d26
  1. 4
      libavcodec/adpcm.c

@ -1209,11 +1209,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
} }
break; break;
case CODEC_ID_ADPCM_EA: case CODEC_ID_ADPCM_EA:
samples_in_chunk = AV_RL32(src); if (buf_size < 4 || AV_RL32(src) >= ((buf_size - 12) * 2)) {
if (samples_in_chunk >= ((buf_size - 12) * 2)) {
src += buf_size; src += buf_size;
break; break;
} }
samples_in_chunk = AV_RL32(src);
src += 4; src += 4;
current_left_sample = (int16_t)bytestream_get_le16(&src); current_left_sample = (int16_t)bytestream_get_le16(&src);
previous_left_sample = (int16_t)bytestream_get_le16(&src); previous_left_sample = (int16_t)bytestream_get_le16(&src);

Loading…
Cancel
Save