Skip to content

Commit

Permalink
[ALSA] Fix possible invalid memory access in PCM core
Browse files Browse the repository at this point in the history
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: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
  • Loading branch information
Takashi Iwai authored and Jaroslav Kysela committed Feb 9, 2007
1 parent bc7320c commit 0981a26
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sound/core/pcm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,11 @@ int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *
{
unsigned int k;
int changed = 0;

if (!count) {
i->empty = 1;
return -EINVAL;
}
for (k = 0; k < count; k++) {
if (mask && !(mask & (1 << k)))
continue;
Expand Down

0 comments on commit 0981a26

Please sign in to comment.