Skip to content

topology: decoder: fix wrong sizeof for enum control allocation in dapm#501

Open
kv2019i wants to merge 1 commit intoalsa-project:masterfrom
kv2019i:202603-tplg2-enum-decode-fix
Open

topology: decoder: fix wrong sizeof for enum control allocation in dapm#501
kv2019i wants to merge 1 commit intoalsa-project:masterfrom
kv2019i:202603-tplg2-enum-decode-fix

Conversation

@kv2019i
Copy link
Copy Markdown
Contributor

@kv2019i kv2019i commented Mar 23, 2026

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.

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.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants