changeset 7660:6fe7ff34a4db libavcodec

alac : check readsamplesize to ensure get_bits() doesn't fail. Patch by Matthieu Castet <castet.matthieu AT free fr>
author jai_menon
date Fri, 22 Aug 2008 15:09:20 +0000
parents b87a9296e854
children 258eb30e6f7d
files alac.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/alac.c	Fri Aug 22 14:57:35 2008 +0000
+++ b/alac.c	Fri Aug 22 15:09:20 2008 +0000
@@ -411,7 +411,7 @@
     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 @@
 
     *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 */