diff options
author | Matthieu Castet <castet.matthieu@free.fr> | 2008-08-22 15:09:20 +0000 |
---|---|---|
committer | Jai Menon <jmenon86@gmail.com> | 2008-08-22 15:09:20 +0000 |
commit | 95801b6a0727d6f7e6f1204ce812b1e81613307d (patch) | |
tree | eab37615dd493c445f68553f9508af46d111f380 /libavcodec/alac.c | |
parent | ec6cda8c6eb644d70ba8f9f931d8d4c5513d449d (diff) | |
download | ffmpeg-95801b6a0727d6f7e6f1204ce812b1e81613307d.tar.gz |
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
Diffstat (limited to 'libavcodec/alac.c')
-rw-r--r-- | libavcodec/alac.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/alac.c b/libavcodec/alac.c index cb710a6346..1817161160 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -411,7 +411,7 @@ static int alac_decode_frame(AVCodecContext *avctx, int channels; unsigned int outputsamples; int hassize; - int readsamplesize; + unsigned int readsamplesize; int wasted_bytes; int isnotcompressed; uint8_t interlacing_shift; @@ -476,6 +476,10 @@ static int alac_decode_frame(AVCodecContext *avctx, *outputsize = outputsamples * alac->bytespersample; 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) { /* so it is compressed */ |