Mercurial > mplayer.hg
changeset 4642:e534c7dc0cc0
check for overflow in new_sh_video and new_sh_audio
author | alex |
---|---|
date | Sun, 10 Feb 2002 18:09:20 +0000 |
parents | b7f340349470 |
children | e09b1a5b464d |
files | libmpdemux/demuxer.c libmpdemux/demuxer.h |
diffstat | 2 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demuxer.c Sun Feb 10 17:48:41 2002 +0000 +++ b/libmpdemux/demuxer.c Sun Feb 10 18:09:20 2002 +0000 @@ -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 {
--- a/libmpdemux/demuxer.h Sun Feb 10 17:48:41 2002 +0000 +++ b/libmpdemux/demuxer.h Sun Feb 10 18:09:20 2002 +0000 @@ -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