]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/wmalosslessdec: Fix return code for invalid buffer sizes
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 25 Sep 2013 19:42:56 +0000 (21:42 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 25 Sep 2013 19:50:27 +0000 (21:50 +0200)
Fixes infinite loop
Fixes Ticket2979

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/wmalosslessdec.c

index 50927cae1a28c273ca2bfe5db77e30681e8ac668..df44855e53ba2bd602a2315b2956e4d6a51065b3 100644 (file)
@@ -1178,8 +1178,10 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
         s->packet_done = 0;
 
         /* sanity check for the buffer length */
-        if (buf_size < avctx->block_align)
-            return 0;
+        if (buf_size < avctx->block_align) {
+            av_log(avctx, AV_LOG_ERROR, "buf size %d invalid\n", buf_size);
+            return AVERROR_INVALIDDATA;
+        }
 
         s->next_packet_start = buf_size - avctx->block_align;
         buf_size             = avctx->block_align;