[FFmpeg-devel] [PATCH]Fix deadlock in wma decoder

Carl Eugen Hoyos cehoyos at ag.or.at
Sun Sep 1 20:48:02 CEST 2013


On Sunday 01 September 2013 06:22:10 pm Michael Niedermayer wrote:
> On Sun, Sep 01, 2013 at 04:40:36PM +0200, Carl Eugen Hoyos wrote:
> > Hi!
> >
> > Attached patch fixes ticket #2925 here.
> >
> > Please comment, Carl Eugen
>
> looks good but shouldnt this be treated as an error instead of just
> continuing (and failing randomly later i assume) ?

As in attached?

Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index d46eb33..c7fc802 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -512,6 +512,10 @@ static int wma_decode_block(WMACodecContext *s)
        coef escape coding */
     total_gain = 1;
     for(;;) {
+        if (get_bits_left(&s->gb) < 7) {
+            av_log(s->avctx, AV_LOG_ERROR, "total_gain overread\n");
+            return -1;
+        }
         a = get_bits(&s->gb, 7);
         total_gain += a;
         if (a != 127)


More information about the ffmpeg-devel mailing list