diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-02-01 08:53:49 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-02-09 03:03:31 -0500 |
commit | 0981a260a1fe4a3f22cc70ef01ce38a73f548745 (patch) | |
tree | 0d9921010091f045bb937493e44649088c71ad02 /sound/core | |
parent | bc7320c5c8ddeb3b50c6a24013dab9ba74bce578 (diff) |
[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: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/pcm_lib.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index b336797be4fc..9fefcaa2c324 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -781,6 +781,11 @@ int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int * | |||
781 | { | 781 | { |
782 | unsigned int k; | 782 | unsigned int k; |
783 | int changed = 0; | 783 | int changed = 0; |
784 | |||
785 | if (!count) { | ||
786 | i->empty = 1; | ||
787 | return -EINVAL; | ||
788 | } | ||
784 | for (k = 0; k < count; k++) { | 789 | for (k = 0; k < count; k++) { |
785 | if (mask && !(mask & (1 << k))) | 790 | if (mask && !(mask & (1 << k))) |
786 | continue; | 791 | continue; |