Check for invalid VLC value in smacker decoder.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 12 Sep 2011 21:49:36 +0000 (23:49 +0200)
committerAnton Khirnov <anton@khirnov.net>
Wed, 21 Sep 2011 12:28:14 +0000 (14:28 +0200)
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 6489455495fc5bfbebcfe3f57e5d4fdd6a781091)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavcodec/smacker.c

index e8de0d8..9628b07 100644 (file)
@@ -139,6 +139,8 @@ static int smacker_decode_bigtree(GetBitContext *gb, HuffContext *hc, DBCtx *ctx
         b2 = get_bits_count(gb);
         i2 = ctx->v2->table ? get_vlc2(gb, ctx->v2->table, SMKTREE_BITS, 3) : 0;
         b2 = get_bits_count(gb) - b2;
+        if (i1 < 0 || i2 < 0)
+            return -1;
         val = ctx->recode1[i1] | (ctx->recode2[i2] << 8);
         if(val == ctx->escapes[0]) {
             ctx->last[0] = hc->current;