[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mplayer-dev-eng
Subject:    [MPlayer-dev-eng] PATCH: Certain Real files plays improperly.
From:       "Joakim Plate" <joakim.plate () ecce ! se>
Date:       2005-02-27 12:43:56
Message-ID: 20050227124433.2DD05508002 () mailrelay1 ! bredband ! net
[Download RAW message or body]

Hi,

This patch fixes a potential data corruption in the index table of real
files. 

demux_real.c:add_index_item() tries to grow the index table on demand if it
exceeds current dimension. It grows it by halv the current size. However on
first call to add_index_item, index_malloc_size is 0 even thou the
index_table_size can be larger since it has been allocated at another point
where index_malloc_size hasn't been set. This leads to setting
index_malloc_size to 2048. If now index_table_size is larger 2048 already,
realloc is called with a size which is smalled than current, and last part
of that index table is lost.

Regards
elupus

["demux_real.c.patch" (application/octet-stream)]

Index: libmpdemux/demux_real.c
===================================================================
RCS file: /cvsroot/xbmc/mplayer/libmpdemux/demux_real.c,v
retrieving revision 1.6
diff -u -r1.6 demux_real.c
--- libmpdemux/demux_real.c	2 Jan 2005 19:08:25 -0000	1.6
+++ libmpdemux/demux_real.c	27 Feb 2005 12:12:42 -0000
@@ -226,10 +226,12 @@
     real_index_table_t *index;
     if (priv->index_table_size[stream_id] >= priv->index_malloc_size[stream_id])
     {
+      while (priv->index_table_size[stream_id] >=priv->index_malloc_size[stream_id]) \
{  if (priv->index_malloc_size[stream_id] == 0)
 	priv->index_malloc_size[stream_id] = 2048;
       else
 	priv->index_malloc_size[stream_id] += priv->index_malloc_size[stream_id] / 2;
+      }
       priv->index_table[stream_id] = realloc(priv->index_table[stream_id], \
priv->index_malloc_size[stream_id]*sizeof(priv->index_table[0][0]));  }
     if (priv->index_table_size[stream_id] > 0)



_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@mplayerhq.hu
http://mplayerhq.hu/mailman/listinfo/mplayer-dev-eng


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic