From 0981a260a1fe4a3f22cc70ef01ce38a73f548745 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 1 Feb 2007 14:53:49 +0100 Subject: [PATCH] [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 Signed-off-by: Jaroslav Kysela --- sound/core/pcm_lib.c | 5 +++++ 1 file changed, 5 insertions(+) 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 * { 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; -- 2.34.1