changeset 4017:b1a1fb651bf5 libavcodec

Move block size check to decoder
author kostya
date Sat, 14 Oct 2006 05:01:05 +0000
parents 29ea06410ce7
children 9c8ab288ebf6
files wavpack.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/wavpack.c	Fri Oct 13 16:19:15 2006 +0000
+++ b/wavpack.c	Sat Oct 14 05:01:05 2006 +0000
@@ -388,6 +388,11 @@
     memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr));
 
     s->samples = LE_32(buf); buf += 4;
+    /* should not happen but who knows */
+    if(s->samples * 2 * avctx->channels > AVCODEC_MAX_AUDIO_FRAME_SIZE){
+        av_log(avctx, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n");
+        return -1;
+    }
     s->joint = LE_32(buf) & WV_JOINT; buf += 4;
     s->CRC = LE_32(buf); buf += 4;
     // parse metadata blocks