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

ramiro subversion at mplayerhq.hu
Tue Jun 24 16:12:20 CEST 2008


Author: ramiro
Date: Tue Jun 24 16:12:20 2008
New Revision: 2567

Log:
Correct remaining buffer size for init_get_bits() using new bytes_left variable.
A bit cleaner than r2566.

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

Copied: mlp/mlpdec.c (from r2565, /mlp/mlpdec.c)
==============================================================================
--- /mlp/mlpdec.c	(original)
+++ mlp/mlpdec.c	Tue Jun 24 16:12:20 2008
@@ -967,7 +967,7 @@ static int read_access_unit(AVCodecConte
 {
     MLPDecodeContext *m = avctx->priv_data;
     GetBitContext gb;
-    unsigned int length, substr;
+    unsigned int length, substr, bytes_left;
     unsigned int substream_start;
     unsigned int header_size;
     uint8_t substream_parity_present[MAX_SUBSTREAMS];
@@ -976,15 +976,16 @@ static int read_access_unit(AVCodecConte
     if (buf_size < 2)
         return 0;
 
-    length = (AV_RB16(buf) & 0xfff) * 2;
+    bytes_left = length = (AV_RB16(buf) & 0xfff) * 2;
 
     if (length > buf_size)
         return -1;
 
     buf      += 4;
     buf_size -= 4;
+    bytes_left -= 4;
 
-    init_get_bits(&gb, buf, length * 8);
+    init_get_bits(&gb, buf, bytes_left * 8);
 
     if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) {
         dprintf(m->avctx, "Found major sync\n");



More information about the FFmpeg-soc mailing list