Skip to content

Commit 6a32425

Browse files
Artemii Karasevtiwai
authored andcommitted
ALSA: emux: Avoid potential array out-of-bound in snd_emux_xg_control()
snd_emux_xg_control() can be called with an argument 'param' greater than size of 'control' array. It may lead to accessing 'control' array at a wrong index. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Artemii Karasev <[email protected]> Fixes: 1da177e ("Linux-2.6.12-rc2") Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 6c4715a commit 6a32425

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sound/synth/emux/emux_nrpn.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ int
349349
snd_emux_xg_control(struct snd_emux_port *port, struct snd_midi_channel *chan,
350350
int param)
351351
{
352+
if (param >= ARRAY_SIZE(chan->control))
353+
return -EINVAL;
354+
352355
return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects),
353356
port, chan, param,
354357
chan->control[param],

0 commit comments

Comments
 (0)