Commit 95801b6a authored by Matthieu Castet's avatar Matthieu Castet Committed by Jai Menon

alac : check readsamplesize to ensure get_bits() doesn't

fail. Patch by Matthieu Castet <castet.matthieu AT free fr>

Originally committed as revision 14905 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent ec6cda8c
...@@ -411,7 +411,7 @@ static int alac_decode_frame(AVCodecContext *avctx, ...@@ -411,7 +411,7 @@ static int alac_decode_frame(AVCodecContext *avctx,
int channels; int channels;
unsigned int outputsamples; unsigned int outputsamples;
int hassize; int hassize;
int readsamplesize; unsigned int readsamplesize;
int wasted_bytes; int wasted_bytes;
int isnotcompressed; int isnotcompressed;
uint8_t interlacing_shift; uint8_t interlacing_shift;
...@@ -476,6 +476,10 @@ static int alac_decode_frame(AVCodecContext *avctx, ...@@ -476,6 +476,10 @@ static int alac_decode_frame(AVCodecContext *avctx,
*outputsize = outputsamples * alac->bytespersample; *outputsize = outputsamples * alac->bytespersample;
readsamplesize = alac->setinfo_sample_size - (wasted_bytes * 8) + channels - 1; readsamplesize = alac->setinfo_sample_size - (wasted_bytes * 8) + channels - 1;
if (readsamplesize > MIN_CACHE_BITS) {
av_log(avctx, AV_LOG_ERROR, "readsamplesize too big (%d)\n", readsamplesize);
return -1;
}
if (!isnotcompressed) { if (!isnotcompressed) {
/* so it is compressed */ /* so it is compressed */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment