]> git.ipfire.org Git - thirdparty/qemu.git/commit
virtio-snd: check for invalid param shift operands
authorManos Pitsidianakis <manos.pitsidianakis@linaro.org>
Thu, 11 Jul 2024 07:38:49 +0000 (10:38 +0300)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 27 Aug 2024 19:13:01 +0000 (22:13 +0300)
commit7eb93056e6de7030255243d994ad87f49030a62c
tree97ed6d3e014e0a3e61391b52f23b9abc8ad1c700
parent3e08a428a795b82c40116a4b079e63017e4d57fa
virtio-snd: check for invalid param shift operands

When setting the parameters of a PCM stream, we compute the bit flag
with the format and rate values as shift operand to check if they are
set in supported_formats and supported_rates.

If the guest provides a format/rate value which when shifting 1 results
in a value bigger than the number of bits in
supported_formats/supported_rates, we must report an error.

Previously, this ended up triggering the not reached assertions later
when converting to internal QEMU values.

Reported-by: Zheyu Ma <zheyuma97@gmail.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2416
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Message-Id: <virtio-snd-fuzz-2416-fix-v1-manos.pitsidianakis@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 9b6083465fb8311f2410615f8303a41f580a2a20)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/audio/virtio-snd.c