From: GitHub pull_request - opened <github@alsa-project.org>
To: alsa-devel@alsa-project.org
Subject: pcm: reject invalid multi bindings without assertions
Date: Fri, 11 Sep 2026 21:22:04 +0200 (CEST) [thread overview]
Message-ID: <18d45a8e502b9200-webhooks-bot@alsa-project.org> (raw)
In-Reply-To: <alsa-project/alsa-lib/pr/524@alsa-project.org>
alsa-project/alsa-lib pull request #524 was opened from HarshRajSinghania:
Fixes #523
The `multi` PCM parser initializes unused binding slots with `slave_idx == -1`. `snd_pcm_multi_open()` previously evaluated `schannels[i] < schannels_count[sidxs[i]]` before checking for an unbound slot, causing a negative array index and an assertion abort for sparse binding configurations.
This patch:
* skips unbound binding slots before dereferencing the slave index;
* validates the slave index and channel explicitly;
* returns `-EINVAL` instead of relying on assertions for malformed configuration.
Reproducer from #523:
```
pcm.null { type null }
pcm.poc {
type multi
slaves.a.pcm "null"
slaves.a.channels 2
bindings.0.slave a
bindings.0.channel 0
bindings.5000.slave a
bindings.5000.channel 1
}
```
Before the patch, alsa-lib aborts with:
```
pcm_multi.c:1125: snd_pcm_multi_open: Assertion `schannels[i] < schannels_count[sidxs[i]]' failed.
```
The fix makes the malformed configuration fail cleanly with `-EINVAL`.
Reported and fixed by Harsh Raj Singhania.
Request URL : https://github.com/alsa-project/alsa-lib/pull/524
Patch URL : https://github.com/alsa-project/alsa-lib/pull/524.patch
Repository URL: https://github.com/alsa-project/alsa-lib
parent reply other threads:[~2026-09-11 19:22 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <alsa-project/alsa-lib/pr/524@alsa-project.org>]
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=18d45a8e502b9200-webhooks-bot@alsa-project.org \
--to=github@alsa-project.org \
--cc=alsa-devel@alsa-project.org \
/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;
as well as URLs for NNTP newsgroup(s).