]> git.alsa-project.org Git - alsa-utils.git/commit
alsamixer: fix segfault in display_controls() with out-of-range index
authorJaroslav Kysela <perex@perex.cz>
Fri, 4 Dec 2026 17:36:29 +0000 (18:36 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 4 Dec 2026 17:36:58 +0000 (18:36 +0100)
commit079e8817e5f74b0b6002c396ce63f9f2b794ab19
treeb0325732d65969958b362a808fe3ad3d583a6614
parentb8d57940a321f2b79f66475102ebcbda85102f6d
alsamixer: fix segfault in display_controls() with out-of-range index

Switching to a view that has no controls (e.g. the Capture view on a
device without any capture controls) and pressing an arrow key could
leave focus_control_index and, in turn, the static
first_visible_control_index at -1.

Reorder the focus clamp so the lower bound is applied last and cast
controls_count to int, and add a lower-bound clamp (plus a signed cast)
for first_visible_control_index in display_controls().

Closes: https://github.com/alsa-project/alsa-utils/issues/335
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsamixer/mixer_display.c
alsamixer/mixer_widget.c