# HG changeset patch # User rtognimp # Date 1082062107 0 # Node ID 064cb156d2b79e38ae9af95e1bf858f4726f4190 # Parent 2e8b305586a0a8943039056fbccf1d08cc617340 10l to me: writing outside allocated memory Patch by Mikulas Patocka < mikulas (at) artax (dot) karlin (dot) mff (dot) cuni (dot) cz> diff -r 2e8b305586a0 -r 064cb156d2b7 libmpdemux/demux_audio.c --- a/libmpdemux/demux_audio.c Thu Apr 15 18:19:39 2004 +0000 +++ b/libmpdemux/demux_audio.c Thu Apr 15 20:48:27 2004 +0000 @@ -168,7 +168,7 @@ free_sh_audio(sh_audio); return 0; } - sh_audio->wf = w = (WAVEFORMATEX*)malloc(l); + sh_audio->wf = w = (WAVEFORMATEX*)malloc(l > sizeof(WAVEFORMATEX) ? l : sizeof(WAVEFORMATEX)); w->wFormatTag = sh_audio->format = stream_read_word_le(s); w->nChannels = sh_audio->channels = stream_read_word_le(s); w->nSamplesPerSec = sh_audio->samplerate = stream_read_dword_le(s);