[Mplayer-cvslog] CVS: main/libmpdemux demuxer.c,1.72,1.73 demuxer.h,1.28,1.29

Alex Beregszaszi alex at mplayer.dev.hu
Sun Feb 10 19:09:22 CET 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv10032

Modified Files:
	demuxer.c demuxer.h 
Log Message:
check for overflow in new_sh_video and new_sh_audio

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- demuxer.c	8 Feb 2002 16:00:14 -0000	1.72
+++ demuxer.c	10 Feb 2002 18:09:20 -0000	1.73
@@ -67,6 +67,12 @@
 }
 
 sh_audio_t* new_sh_audio(demuxer_t *demuxer,int id){
+    if(id > MAX_A_STREAMS-1)
+    {
+	mp_msg(MSGT_DEMUXER,MSGL_WARN,"Requested audio stream id overflow (%d > %d)\n",
+	    id, MAX_A_STREAMS);
+	return NULL;
+    }
     if(demuxer->a_streams[id]){
         mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_AudioStreamRedefined,id);
     } else {
@@ -85,6 +91,12 @@
 }
 
 sh_video_t* new_sh_video(demuxer_t *demuxer,int id){
+    if(id > MAX_V_STREAMS-1)
+    {
+	mp_msg(MSGT_DEMUXER,MSGL_WARN,"Requested video stream id overflow (%d > %d)\n",
+	    id, MAX_V_STREAMS);
+	return NULL;
+    }
     if(demuxer->v_streams[id]){
         mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_VideoStreamRedefined,id);
     } else {

Index: demuxer.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- demuxer.h	6 Feb 2002 20:16:35 -0000	1.28
+++ demuxer.h	10 Feb 2002 18:09:20 -0000	1.29
@@ -71,6 +71,9 @@
   char *copyright;
 } demuxer_info_t;
 
+#define MAX_A_STREAMS 256
+#define MAX_V_STREAMS 256
+
 typedef struct demuxer_st {
   stream_t *stream;
   int synced;  // stream synced (used by mpeg)
@@ -86,8 +89,8 @@
   demux_stream_t *sub;   // dvd subtitle buffer/demuxer
 
   // stream headers:
-  void* a_streams[256]; // audio streams (sh_audio_t)
-  void* v_streams[256]; // video sterams (sh_video_t)
+  void* a_streams[MAX_A_STREAMS]; // audio streams (sh_audio_t)
+  void* v_streams[MAX_V_STREAMS]; // video sterams (sh_video_t)
   char s_streams[32];   // dvd subtitles (flag)
   
   void* priv;  // fileformat-dependent data




More information about the MPlayer-cvslog mailing list