Hi, I'm currently porting ALSA to OS/2 and have encountered a bug in snd_pcm_playback_silence (core\pcm_lib.c) While playing an 8 bits stereo 44.1khz wave file the system would trap when stopping the stream. The cause was heap corruption caused by this function. There is no check to see if the offset + amount of frames to silence is larger than the buffer size. The patch below fixes this.
Sander --- E:\Development\ALSA.Linux\alsa-kernel\core\pcm_lib.c Wed Apr 10 21:55:18 2002 +++ E:\Development\ALSA.OS2\GPL\alsa\core\pcm_lib.c Thu Apr 11 17:01:38 2002 @@ -60,6 +56,12 @@ ofs = runtime->silenced_start % runtime->buffer_size + runtime->silenced_size; if (ofs >= runtime->buffer_size) ofs -= runtime->buffer_size; +#ifdef TARGET_OS2 + if (ofs + frames > runtime->buffer_size) { + frames = runtime->buffer_size - ofs; + } +#endif if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED || runtime->access == SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) { if (substream->ops->silence) { _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel