OSDN Git Service

wmalossless: Fix infinite loop.
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 19 Feb 2012 20:50:18 +0000 (21:50 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 19 Feb 2012 21:08:21 +0000 (22:08 +0100)
Fixes more of Ticket1000

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

index 79cd5f4..b32731f 100644 (file)
@@ -713,8 +713,11 @@ static int decode_channel_residues(WmallDecodeCtx *s, int ch, int tile_size)
     //av_log(0, 0, "%8d: ", num_logged_tiles++);
     for(; i < tile_size; i++) {
         int quo = 0, rem, rem_bits, residue;
-        while(get_bits1(&s->gb))
+        while(get_bits1(&s->gb)) {
             quo++;
+            if (get_bits_left(&s->gb) <= 0)
+                return -1;
+        }
         if(quo >= 32)
             quo += get_bits_long(&s->gb, get_bits(&s->gb, 5) + 1);