pcm: snd_pcm_slave_conf - fix C99 variable-length array allocation
Some checks failed
Build alsa-lib / fedora_latest_build (push) Has been cancelled
Build alsa-lib / ubuntu_last_build (push) Has been cancelled

The C standard (C99 §6.7.5.2p1) requires VLA bounds to be greater than zero;
a bound of 0 is undefined behavior. Reported by UBSan.

Fixes: https://github.com/alsa-project/alsa-lib/issues/505
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2026-05-25 12:34:37 +02:00
parent 6f074eefb1
commit 33c9949e75

View file

@ -7824,7 +7824,7 @@ int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
int flags; int flags;
void *ptr; void *ptr;
int present; int present;
} fields[count]; } fields[count > 0 ? count : 1];
unsigned int k; unsigned int k;
snd_config_t *pcm_conf = NULL; snd_config_t *pcm_conf = NULL;
int err; int err;