[FFmpeg-cvslog] r14170 - trunk/libavcodec/wmadec.c

michael subversion
Fri Jul 11 21:45:52 CEST 2008


Author: michael
Date: Fri Jul 11 21:45:52 2008
New Revision: 14170

Log:
Check that we have enough output space available.


Modified:
   trunk/libavcodec/wmadec.c

Modified: trunk/libavcodec/wmadec.c
==============================================================================
--- trunk/libavcodec/wmadec.c	(original)
+++ trunk/libavcodec/wmadec.c	Fri Jul 11 21:45:52 2008
@@ -781,6 +781,11 @@ static int wma_decode_superframe(AVCodec
         skip_bits(&s->gb, 4); /* super frame index */
         nb_frames = get_bits(&s->gb, 4) - 1;
 
+        if((nb_frames+1) * s->nb_channels * s->frame_len * sizeof(int16_t) > *data_size){
+            av_log(s->avctx, AV_LOG_ERROR, "Insufficient output space\n");
+            goto fail;
+        }
+
         bit_offset = get_bits(&s->gb, s->byte_offset_bits + 3);
 
         if (s->last_superframe_len > 0) {
@@ -836,6 +841,10 @@ static int wma_decode_superframe(AVCodec
         s->last_superframe_len = len;
         memcpy(s->last_superframe, buf + pos, len);
     } else {
+        if(s->nb_channels * s->frame_len * sizeof(int16_t) > *data_size){
+            av_log(s->avctx, AV_LOG_ERROR, "Insufficient output space\n");
+            goto fail;
+        }
         /* single frame decode */
         if (wma_decode_frame(s, samples) < 0)
             goto fail;




More information about the ffmpeg-cvslog mailing list