prores: Handle 0 or fewer bits left
authorAlex Converse <alex.converse@gmail.com>
Thu, 29 Sep 2011 00:50:51 +0000 (17:50 -0700)
committerAlex Converse <alex.converse@gmail.com>
Thu, 29 Sep 2011 16:45:57 +0000 (09:45 -0700)
show_bits() is undefined when the number of bits is less than or equal to
zero.

libavcodec/proresdec.c

index 759c10b6e5f8806893aa90cd7baa68b62977da92..c70d145345afd725bca9601504ee1900faed696f 100644 (file)
@@ -427,13 +427,13 @@ static inline void decode_ac_coeffs(GetBitContext *gb, DCTELEM *out,
         lev_cb_index = lev_to_cb_index[FFMIN(level, 9)];
 
         bits_left = get_bits_left(gb);
         lev_cb_index = lev_to_cb_index[FFMIN(level, 9)];
 
         bits_left = get_bits_left(gb);
-        if (bits_left <= 8 && !show_bits(gb, bits_left))
+        if (bits_left <= 0 || (bits_left <= 8 && !show_bits(gb, bits_left)))
             return;
 
         run = decode_vlc_codeword(gb, ac_codebook[run_cb_index]);
 
         bits_left = get_bits_left(gb);
             return;
 
         run = decode_vlc_codeword(gb, ac_codebook[run_cb_index]);
 
         bits_left = get_bits_left(gb);
-        if (bits_left <= 8 && !show_bits(gb, bits_left))
+        if (bits_left <= 0 || (bits_left <= 8 && !show_bits(gb, bits_left)))
             return;
 
         level = decode_vlc_codeword(gb, ac_codebook[lev_cb_index]) + 1;
             return;
 
         level = decode_vlc_codeword(gb, ac_codebook[lev_cb_index]) + 1;