avcodec/vorbis: fix decoding of single element huffman trees
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 8 Mar 2014 04:13:05 +0000 (05:13 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 8 Mar 2014 04:13:05 +0000 (05:13 +0100)
Fixes Ticket2893

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

index 6d2ff4b..86d1040 100644 (file)
@@ -85,6 +85,11 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
 
     ++p;
 
+    for (i = p; (bits[i] == 0) && (i < num); ++i)
+        ;
+    if (i == num)
+        return 0;
+
     for (; p < num; ++p) {
         if (bits[p] > 32)
              return AVERROR_INVALIDDATA;