Skip to content

Commit

Permalink
ALSA: emux: Avoid potential array out-of-bound in snd_emux_xg_control()
Browse files Browse the repository at this point in the history
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 <karasev@ispras.ru>
Fixes: 1da177e ("Linux-2.6.12-rc2")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230207132026.2870-1-karasev@ispras.ru
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Artemii Karasev authored and tiwai committed Feb 7, 2023
1 parent 6c4715a commit 6a32425
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sound/synth/emux/emux_nrpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ int
snd_emux_xg_control(struct snd_emux_port *port, struct snd_midi_channel *chan,
int param)
{
if (param >= ARRAY_SIZE(chan->control))
return -EINVAL;

return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects),
port, chan, param,
chan->control[param],
Expand Down

0 comments on commit 6a32425

Please sign in to comment.