comparison libmpdemux/demux_audio.c @ 12213:064cb156d2b7

10l to me: writing outside allocated memory Patch by Mikulas Patocka < mikulas (at) artax (dot) karlin (dot) mff (dot) cuni (dot) cz>
author rtognimp
date Thu, 15 Apr 2004 20:48:27 +0000
parents d48eccbbb984
children 8639d064d3a1
comparison
equal deleted inserted replaced
12212:2e8b305586a0 12213:064cb156d2b7
166 if(l < 16) { 166 if(l < 16) {
167 mp_msg(MSGT_DEMUX,MSGL_ERR,"[demux_audio] Bad wav header length: too short (%d)!!!\n",l); 167 mp_msg(MSGT_DEMUX,MSGL_ERR,"[demux_audio] Bad wav header length: too short (%d)!!!\n",l);
168 free_sh_audio(sh_audio); 168 free_sh_audio(sh_audio);
169 return 0; 169 return 0;
170 } 170 }
171 sh_audio->wf = w = (WAVEFORMATEX*)malloc(l); 171 sh_audio->wf = w = (WAVEFORMATEX*)malloc(l > sizeof(WAVEFORMATEX) ? l : sizeof(WAVEFORMATEX));
172 w->wFormatTag = sh_audio->format = stream_read_word_le(s); 172 w->wFormatTag = sh_audio->format = stream_read_word_le(s);
173 w->nChannels = sh_audio->channels = stream_read_word_le(s); 173 w->nChannels = sh_audio->channels = stream_read_word_le(s);
174 w->nSamplesPerSec = sh_audio->samplerate = stream_read_dword_le(s); 174 w->nSamplesPerSec = sh_audio->samplerate = stream_read_dword_le(s);
175 w->nAvgBytesPerSec = stream_read_dword_le(s); 175 w->nAvgBytesPerSec = stream_read_dword_le(s);
176 w->nBlockAlign = stream_read_word_le(s); 176 w->nBlockAlign = stream_read_word_le(s);