]> 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>
Wed, 24 Jul 2024 04:38:33 +0000 (07:38 +0300)
commit439009617e85f369756808c4e54c399583196d38
treec3116e6925a2c82afda9fdb43872df1efd9e79bf
parent6ef295cb1c67575a4ae291a5c756b82db0cf5bbe
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