changeset 9592:05661d19f6d2 libavcodec

Check whether extra bits block has enough data. Patch by Laurent Aimar "f\145nr\151r >at< vide\157lan <dot> o\162g"
author kostya
date Sun, 03 May 2009 05:42:51 +0000
parents 483ba97736f8
children b8140a218b1d
files wavpack.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/wavpack.c	Sat May 02 09:12:03 2009 +0000
+++ b/wavpack.c	Sun May 03 05:42:51 2009 +0000
@@ -795,6 +795,14 @@
         av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n");
         return -1;
     }
+    if(s->got_extra_bits){
+        const int size = s->gb_extra_bits.size_in_bits - get_bits_count(&s->gb_extra_bits);
+        const int wanted = s->samples * s->extra_bits << s->stereo_in;
+        if(size < wanted){
+            av_log(avctx, AV_LOG_ERROR, "Too small EXTRABITS\n");
+            s->got_extra_bits = 0;
+        }
+    }
 
     if(s->stereo_in){
         if(bpp == 2)