changeset 7262:e3822c61f2e4 libavcodec

mlpdec: Check for bits left before each read of End-of-Stream indicator and Substream parity check independently. This allows decoding of streams that have EOS but don't have Substream parity check.
author ramiro
date Sun, 13 Jul 2008 14:59:39 +0000
parents 032a49f033e8
children fc843d00867c
files mlpdec.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mlpdec.c	Sun Jul 13 14:56:01 2008 +0000
+++ b/mlpdec.c	Sun Jul 13 14:59:39 2008 +0000
@@ -1119,7 +1119,7 @@
                  && get_bits1(&gb) == 0);
 
         skip_bits(&gb, (-get_bits_count(&gb)) & 15);
-        if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 48 &&
+        if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32 &&
             (show_bits_long(&gb, 32) == 0xd234d234 ||
              show_bits_long(&gb, 20) == 0xd234e)) {
             skip_bits(&gb, 18);
@@ -1133,7 +1133,8 @@
             } else
                 skip_bits(&gb, 13);
         }
-        if (substream_parity_present[substr]) {
+        if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 16 &&
+            substream_parity_present[substr]) {
             uint8_t parity, checksum;
 
             parity = calculate_parity(buf, substream_data_len[substr] - 2);