changeset 9565:5c1aeaf1bc12 libavcodec

Proper subpacket size check for cook multichannel files.
author banan
date Sat, 25 Apr 2009 20:09:34 +0000
parents 2bc00c8d1311
children 9a3fddd31092
files cook.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cook.c	Sat Apr 25 19:47:18 2009 +0000
+++ b/cook.c	Sat Apr 25 20:09:34 2009 +0000
@@ -72,7 +72,7 @@
 
 typedef struct {
     int                 ch_idx;
-    unsigned int        size;
+    int                 size;
     int                 num_channels;
     int                 cookversion;
     int                 samples_per_frame;
@@ -1011,6 +1011,10 @@
     for(i=1;i<q->num_subpackets;i++){
         q->subpacket[i].size = 2 * buf[avctx->block_align - q->num_subpackets + i];
         q->subpacket[0].size -= q->subpacket[i].size + 1;
+        if (q->subpacket[0].size < 0) {
+            av_log(avctx,AV_LOG_DEBUG,"frame subpacket size total > avctx->block_align!\n");
+            return -1;
+        }
     }
 
     /* decode supbackets */