From a5bb61d811d9a3839c1602b70327ebeebbdf01fb Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 24 Jul 2003 18:13:28 +0000 Subject: [PATCH] Added checks for invalid values for SPACE ioctls --- alsa-oss.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/alsa-oss.c b/alsa-oss.c index 3237f34..a2c0c8b 100644 --- a/alsa-oss.c +++ b/alsa-oss.c @@ -1023,6 +1023,8 @@ static int oss_dsp_ioctl(int fd, unsigned long cmd, ...) avail = snd_pcm_avail_update(pcm); if (avail < 0) avail = 0; + if ((snd_pcm_uframes_t)avail > str->buffer_size) + avail = str->buffer_size; info->fragsize = str->period_size * str->frame_bytes; info->fragstotal = str->periods; info->bytes = avail * str->frame_bytes; @@ -1053,7 +1055,7 @@ static int oss_dsp_ioctl(int fd, unsigned long cmd, ...) oss_dsp_mmap_update(dsp, SND_PCM_STREAM_PLAYBACK, delay); } avail = snd_pcm_avail_update(pcm); - if (avail < 0) + if (avail < 0 || (snd_pcm_uframes_t)avail > str->buffer_size) avail = str->buffer_size; info->fragsize = str->period_size * str->frame_bytes; info->fragstotal = str->periods; -- 2.47.1