[MPlayer-cvslog] r32707 - trunk/libmpdemux/aviheader.c

reimar subversion at mplayerhq.hu
Sun Dec 12 15:31:18 CET 2010


Author: reimar
Date: Sun Dec 12 15:31:17 2010
New Revision: 32707

Log:
Avoid using uninitialized data if index read does not return enough data.

Modified:
   trunk/libmpdemux/aviheader.c

Modified: trunk/libmpdemux/aviheader.c
==============================================================================
--- trunk/libmpdemux/aviheader.c	Sun Dec 12 14:56:35 2010	(r32706)
+++ trunk/libmpdemux/aviheader.c	Sun Dec 12 15:31:17 2010	(r32707)
@@ -378,13 +378,15 @@ while(1){
     if(demuxer->movi_end>stream_tell(demuxer->stream))
 	demuxer->movi_end=stream_tell(demuxer->stream); // fixup movi-end
     if(index_mode && !priv->isodml){
+      int read;
       int i;
       priv->idx_size=size2>>4;
       mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_ReadingIndexBlockChunksForFrames,
         priv->idx_size,avih.dwTotalFrames, (int64_t)stream_tell(demuxer->stream));
       priv->idx=malloc(priv->idx_size<<4);
 //      printf("\nindex to %p !!!!! (priv=%p)\n",priv->idx,priv);
-      stream_read(demuxer->stream,(char*)priv->idx,priv->idx_size<<4);
+      read = stream_read(demuxer->stream,(char*)priv->idx,priv->idx_size<<4);
+      priv->idx_size = FFMAX(read, 0) >> 4;
       for (i = 0; i < priv->idx_size; i++) {	// swap index to machine endian
 	AVIINDEXENTRY *entry=(AVIINDEXENTRY*)priv->idx + i;
 	le2me_AVIINDEXENTRY(entry);


More information about the MPlayer-cvslog mailing list