Commit 0981a260 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Fix possible invalid memory access in PCM core

snd_internval_list() may access invalid memory in the case count = 0
is given.  It shouldn't be passed, but it'd better to make the code
a bit more robust.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent bc7320c5
...@@ -781,6 +781,11 @@ int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int * ...@@ -781,6 +781,11 @@ int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *
{ {
unsigned int k; unsigned int k;
int changed = 0; int changed = 0;
if (!count) {
i->empty = 1;
return -EINVAL;
}
for (k = 0; k < count; k++) { for (k = 0; k < count; k++) {
if (mask && !(mask & (1 << k))) if (mask && !(mask & (1 << k)))
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment