Mercurial > mplayer.hg
comparison libmpdemux/demuxer.c @ 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 | 886bf5274992 |
children | 25b2a036aee7 |
comparison
equal
deleted
inserted
replaced
4641:b7f340349470 | 4642:e534c7dc0cc0 |
---|---|
65 stream_seek(stream,stream->start_pos); | 65 stream_seek(stream,stream->start_pos); |
66 return d; | 66 return d; |
67 } | 67 } |
68 | 68 |
69 sh_audio_t* new_sh_audio(demuxer_t *demuxer,int id){ | 69 sh_audio_t* new_sh_audio(demuxer_t *demuxer,int id){ |
70 if(id > MAX_A_STREAMS-1) | |
71 { | |
72 mp_msg(MSGT_DEMUXER,MSGL_WARN,"Requested audio stream id overflow (%d > %d)\n", | |
73 id, MAX_A_STREAMS); | |
74 return NULL; | |
75 } | |
70 if(demuxer->a_streams[id]){ | 76 if(demuxer->a_streams[id]){ |
71 mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_AudioStreamRedefined,id); | 77 mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_AudioStreamRedefined,id); |
72 } else { | 78 } else { |
73 mp_msg(MSGT_DEMUXER,MSGL_V,"==> Found audio stream: %d\n",id); | 79 mp_msg(MSGT_DEMUXER,MSGL_V,"==> Found audio stream: %d\n",id); |
74 demuxer->a_streams[id]=malloc(sizeof(sh_audio_t)); | 80 demuxer->a_streams[id]=malloc(sizeof(sh_audio_t)); |
83 if(sh->wf) free(sh->wf); | 89 if(sh->wf) free(sh->wf); |
84 free(sh); | 90 free(sh); |
85 } | 91 } |
86 | 92 |
87 sh_video_t* new_sh_video(demuxer_t *demuxer,int id){ | 93 sh_video_t* new_sh_video(demuxer_t *demuxer,int id){ |
94 if(id > MAX_V_STREAMS-1) | |
95 { | |
96 mp_msg(MSGT_DEMUXER,MSGL_WARN,"Requested video stream id overflow (%d > %d)\n", | |
97 id, MAX_V_STREAMS); | |
98 return NULL; | |
99 } | |
88 if(demuxer->v_streams[id]){ | 100 if(demuxer->v_streams[id]){ |
89 mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_VideoStreamRedefined,id); | 101 mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_VideoStreamRedefined,id); |
90 } else { | 102 } else { |
91 mp_msg(MSGT_DEMUXER,MSGL_V,"==> Found video stream: %d\n",id); | 103 mp_msg(MSGT_DEMUXER,MSGL_V,"==> Found video stream: %d\n",id); |
92 demuxer->v_streams[id]=malloc(sizeof(sh_video_t)); | 104 demuxer->v_streams[id]=malloc(sizeof(sh_video_t)); |