[FFmpeg-soc] [soc]: r2581 - mlp/mlpdec.c

ramiro subversion at mplayerhq.hu
Sat Jun 28 13:30:25 CEST 2008


Author: ramiro
Date: Sat Jun 28 13:30:25 2008
New Revision: 2581

Log:
Revert and remove some bounds checking.

Added:
   mlp/mlpdec.c
      - copied, changed from r2577, /mlp/mlpdec.c

Copied: mlp/mlpdec.c (from r2577, /mlp/mlpdec.c)
==============================================================================
--- /mlp/mlpdec.c	(original)
+++ mlp/mlpdec.c	Sat Jun 28 13:30:25 2008
@@ -967,7 +967,7 @@ static int read_access_unit(AVCodecConte
 {
     MLPDecodeContext *m = avctx->priv_data;
     GetBitContext gb;
-    unsigned int length, substr, bytes_left;
+    unsigned int length, substr;
     unsigned int substream_start;
     unsigned int header_size = 4;
     uint8_t substream_parity_present[MAX_SUBSTREAMS];
@@ -978,23 +978,21 @@ static int read_access_unit(AVCodecConte
     if (buf_size < 4)
         return 0;
 
-    bytes_left = length = (AV_RB16(buf) & 0xfff) * 2;
+    length = (AV_RB16(buf) & 0xfff) * 2;
 
     if (length > buf_size)
         return -1;
 
     for(i = 0; i < 4; i++)
         parity_bits ^= *buf++;
-    bytes_left -= 4;
 
-    init_get_bits(&gb, buf, bytes_left * 8);
+    init_get_bits(&gb, buf, (length - 4) * 8);
 
     if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) {
         dprintf(m->avctx, "Found major sync\n");
         if (read_major_sync(m, &gb) < 0)
             goto error;
         header_size += 28;
-        bytes_left -= 28;
         buf += 28;
     }
 
@@ -1019,14 +1017,12 @@ static int read_access_unit(AVCodecConte
         parity_bits ^= *buf++;
         parity_bits ^= *buf++;
         header_size += 2;
-        bytes_left -= 2;
 
         if (extraword_present) {
             skip_bits(&gb, 16);
             parity_bits ^= *buf++;
             parity_bits ^= *buf++;
             header_size += 2;
-            bytes_left -= 2;
         }
 
         if (end + header_size > length) {
@@ -1129,7 +1125,6 @@ static int read_access_unit(AVCodecConte
         }
 
         buf += substream_data_len[substr];
-        bytes_left -= substream_data_len[substr];
     }
 
     rematrix_channels(m, substr - 1);



More information about the FFmpeg-soc mailing list