* pcm_multi accepts sparse/unbound bindings and aborts via assertion
[not found] <18d45a893983c000-webhooks-bot@alsa-project.org>
@ 2026-09-11 19:21 ` GitHub issues - opened
0 siblings, 0 replies; only message in thread
From: GitHub issues - opened @ 2026-09-11 19:21 UTC (permalink / raw)
To: alsa-devel
alsa-project/alsa-lib issue #523 was opened from HarshRajSinghania:
### Summary
The `multi` PCM configuration parser can leave intermediate binding slots unbound (`slave_idx == -1`), but `snd_pcm_multi_open()` evaluates `schannels[i] < schannels_count[sidxs[i]]` before checking whether `sidxs[i]` is negative. A sparse binding therefore indexes `schannels_count[-1]` and, in builds with assertions enabled, aborts the process.
### Reproducer
```
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
}
```
Opening `poc` with alsa-lib 1.2.14 reaches `snd_pcm_multi_open()` and terminates with:
```
pcm_multi.c:1125: snd_pcm_multi_open: Assertion `schannels[i] < schannels_count[sidxs[i]]' failed.
Aborted
```
The configuration documentation explicitly permits binding entries indexed by `N`, so sparse binding indices are representable configuration input.
### Suggested fix
Treat an unbound slot as unbound before indexing `schannels_count`, and return `-EINVAL` for an invalid slave index/channel instead of relying on assertions.
I have a patch prepared that makes these checks explicit and avoids the negative-index access/assertion abort.
Reported by Harsh Raj Singhania.
Issue URL : https://github.com/alsa-project/alsa-lib/issues/523
Repository URL: https://github.com/alsa-project/alsa-lib
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-11 19:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <18d45a893983c000-webhooks-bot@alsa-project.org>
2026-09-11 19:21 ` pcm_multi accepts sparse/unbound bindings and aborts via assertion GitHub issues - opened
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox