Bug#695593: [PATCH] wmadec: avoid an infinitive loop

siretart at gmail.com siretart at gmail.com
Mon May 20 13:50:00 UTC 2013


From: Laurent Bigonville <bigon at debian.org>

In some situations, transcoding a wmav2 file can lead to a infinite loop
(which is leaking a lot of memory).

CC: libav-stable at libav.org
---
 libavcodec/wmadec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

For full context of this patch, please
cf. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695593 and
http://avcodec.org/trac/ffmpeg/ticket/286.

Cheers,
Reinhard

diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index b9b176e..5d0aac7 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -812,7 +812,8 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
                buf_size, avctx->block_align);
         return AVERROR_INVALIDDATA;
     }
-    buf_size = avctx->block_align;
+    if(avctx->block_align)
+        buf_size = avctx->block_align;
 
     init_get_bits(&s->gb, buf, buf_size*8);
 
@@ -911,7 +912,7 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
 
     *got_frame_ptr = 1;
 
-    return avctx->block_align;
+    return buf_size;
  fail:
     /* when error, we reset the bit reservoir */
     s->last_superframe_len = 0;
-- 
1.8.1.2



More information about the pkg-multimedia-maintainers mailing list