Dirk Müller [Tue, 2 Jun 2026 09:17:31 +0000 (11:17 +0200)]
Fix theoretical one-byte buffer overrun
If 64 (sizeof(buf))= or more characters were provided in the input string,
this unconditionally writes a null byte to `buf[64]`, which is one byte
past the end of the array.
Closes: https://github.com/alsa-project/alsa-lib/pull/509 Signed-off-by: Dirk Müller <dirk@dmllr.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Rudi Heitbaum [Fri, 20 Feb 2026 11:31:02 +0000 (11:31 +0000)]
conf, seq, ucm: fix discards const from pointer target
Since glibc-2.43:
For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers
into their input arrays now have definitions as macros that return a
pointer to a const-qualified type when the input argument is a pointer
to a const-qualified type.
Seppo Ingalsuo [Wed, 4 Mar 2026 11:10:09 +0000 (13:10 +0200)]
Topology: Add high and extended rates from Linux 6.12
This patch adds to topologies build support for the very high
sample rates 352.8 kHz, 384 kHz, 705,6 kHz, and 768 kHz. The added
extended rates those were introduced in Linux kernel version 6.12
are 12 kHz, 24 kHz, and 128 kHz.
Closes: https://github.com/alsa-project/alsa-lib/pull/497 Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Kai Vehmanen [Mon, 23 Mar 2026 15:10:33 +0000 (17:10 +0200)]
topology: decoder: fix wrong sizeof for enum control allocation in dapm
The tplg_calloc() call for enum control in the dapm widget kcontrol
decode loop used sizeof(*mt) (mixer template) instead of sizeof(*et)
(enum template). On 64-bit systems, snd_tplg_mixer_template is 72 bytes
while snd_tplg_enum_template is 80 bytes, causing an 8-byte heap buffer
overflow when the enum fields (texts, values pointers) were written past
the allocated block. This resulted in heap corruption and e.g. glibc
malloc hit an assert.
Closes: https://github.com/alsa-project/alsa-lib/pull/501 Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Extend DefineRegex to support two matching schemes:
- "first" (default): matches pattern once, extracts capture groups
- "all": matches pattern multiple times, extracts all matches
The "all" scheme creates variables with naming pattern nameN for Nth
match and nameN_M for Nth match's Mth capture group, enabling
extraction of repeating patterns from strings.
Updated documentation with detailed examples and comprehensive
description of regex flags, schemes, and variable naming conventions.
Jaroslav Kysela [Wed, 18 Feb 2026 12:23:26 +0000 (13:23 +0100)]
ucm: add show_err parameter to uc_mgr_get_variable
Add bool show_err parameter to uc_mgr_get_variable() to control whether
an error message is displayed when a variable is not defined. This
centralizes error reporting and eliminates redundant error messages
in callers.
Jaroslav Kysela [Wed, 18 Feb 2026 11:13:15 +0000 (12:13 +0100)]
ucm: find-card,find-device - add UCM variable support for arguments (Syntax 9)
Add variable support for all lookup arguments in find-card and find-device
substitutions. Variables are identified by $ prefix and only enabled for
Syntax 9+ to maintain backward compatibility.
Example usage:
${find-card:field=$FieldName,regex=$Pattern,return=number}
${find-device:type=$DevType,stream=$StreamType,field=$FieldName,regex=$Pattern}
Jaroslav Kysela [Mon, 9 Feb 2026 15:02:01 +0000 (16:02 +0100)]
ucm: add info-card substitution (Syntax 9)
Implement ${info-card:} substitution to retrieve specific fields from
a card's information structure by card number or ID. Unlike ${find-card:}
which searches through cards using regex, ${info-card:} directly queries
a specific card.
Arguments:
card=<STR> card number or card ID (string identifier)
field=<STR> number, id, driver, name, longname, mixername, components
Allow card and field parameters to reference UCM variables by prefixing
with $ character. When the first character is $, the value is resolved
using uc_mgr_get_variable().
Example usage:
${info-card:card=$MyCard,field=$MyField}
Jaroslav Kysela [Fri, 6 Feb 2026 17:41:30 +0000 (18:41 +0100)]
ucm: allow string with substitution for If.Condition block (Syntax 9)
When If.Condition is a string type instead of compound, parse it using
snd_config_load_string with variable substitution support for syntax v9+.
This allows more flexible condition definitions using variable references.
Jaroslav Kysela [Fri, 6 Feb 2026 17:25:01 +0000 (18:25 +0100)]
ucm: optimize if_eval_string with common comparison helper
Refactor if_eval_string() to eliminate code duplication by introducing
a compare_strings() helper function that handles the common pattern of
retrieving, substituting, and comparing string pairs.
Implements Repeat blocks for generating repetitive configuration patterns
with variable substitution. This feature allows applying a configuration
block multiple times with different variable values, significantly reducing
duplication in UCM configuration files.
iterator abstraction allows easy extension for future pattern types.
Example:
Repeat.VolumeInit {
Pattern {
Variable 'ch'
Type Integer
First 0
Last 7
Step 1
}
Apply {
cset "name='PCM Channel ${var:ch} Volume' 100%"
}
}
Jaroslav Kysela [Fri, 6 Feb 2026 11:57:02 +0000 (12:57 +0100)]
ucm: add integer comparison condition (Syntax 9)
Adds support for integer comparison operations in If.Condition blocks.
Supports operators: ==, !=, <, >, <=, >= for comparing integer values.
Both values are substituted and converted from strings to 64-bit integers.
Hexadecimal (C like) strings are also accepted (like 0x1234).
Example usage:
If.check_channels {
Condition {
Type Integer
Operation ">"
Value1 "${var:channels}"
Value2 "2"
}
True { ... }
}
Jaroslav Kysela [Mon, 26 Jan 2026 14:08:54 +0000 (15:08 +0100)]
ucm: libconfig parser - fix pathname for substituted file
The path name substituted file contents and normal file contents
should be handled similary. Use correct function determining
the right base directory name.
Fixes: 8f5779eb ("ucm: add LibraryConfig support") Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Tue, 13 Jan 2026 07:09:47 +0000 (08:09 +0100)]
seq: return back old snd_seq_drain_output behaviour for -EAGAIN
It seems that many applications did not follow the documentation
including pyalsa sequencer module, thus return the previous
behaviour and correct documentation.
Closes: https://github.com/alsa-project/alsa-lib/issues/493 Fixes: b97a11ec ("seq: fix snd_seq_drain_output return value for partial drain") Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Wed, 7 Jan 2026 16:41:03 +0000 (17:41 +0100)]
error: return old snd_lib_error_set_handler() behaviour
Unfortunately, the case when the old application sets
own error callback using the old method, was not handled
properly in snd_lib_vlog_default() function.
Make sure that only error messages are passed to this
old callback and silent other log priorities.
Jaroslav Kysela [Wed, 10 Dec 2025 15:44:12 +0000 (16:44 +0100)]
conf: cards: unify whitespace - use tabs and remove trailing spaces
Convert leading spaces to tabs for consistent indentation,
remove trailing whitespace from all lines, and normalize
file endings across all card configuration files.
Jaroslav Kysela [Mon, 1 Dec 2025 14:56:56 +0000 (15:56 +0100)]
ucm: complete dependency graphs for conflicting/supported device lists
Modify verb_dev_list_check() to ensure all devices in a conflicting or
supported group reference each other. Previously, the function only
ensured bidirectional relationships. Now it ensures all devices in
the same group have complete dependency lists.
Jaroslav Kysela [Mon, 1 Dec 2025 12:32:10 +0000 (13:32 +0100)]
ucm: implement ValueDefaults.BootCardGroup and define use
We need a boot synchronization for multiple UCM cards where linking
is expected like AMD ACP or Intel AVS drivers. This method is
using a timestamp file which can be created and modified during
the boot process (e.g. from the alsactl tool).
The goal is to return a valid UCM configuration for standard
applications combining multiple ALSA cards into one UCM configuration
and cover the time window when all cards have not been probed yet.