Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Артемий Карасев" <karasev@ispras.ru>
To: "Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org
Subject: ALSA: emux: Avoid potential array out-of-bound in snd_emux_xg_control()
Date: Fri, 03 Feb 2023 09:00:24 +0300	[thread overview]
Message-ID: <1675404024.959949439@f378.i.mail.ru> (raw)


In snd_emux_control() method "snd_emux_port" can be passed with 
field chset.midi_mode == SNDRV_MIDI_MODE_XG. The "type" can be 
MIDI_CTL_PITCHBEND or MIDI_CTL_CHAN_PRESSURE.
It may lead to accessing 'control' array of size 128 with 
MIDI_CTL_PITCHBEND (0x80) or MIDI_CTL_CHAN_PRESSURE (0x82) index.
 
How can we prevent this? Would it be a good solution to place code like this 
before call snd_emux_xg_control()?
 
if (type == MIDI_CTL_PITCHBEND || type == MIDI_CTL_CHAN_PRESSURE){
    return;
}
 
Found by Linux Verification Center (linuxtesting.org) with SVACE.

                 reply	other threads:[~2023-02-03  6:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1675404024.959949439@f378.i.mail.ru \
    --to=karasev@ispras.ru \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox