The assertion vol->channels < sizeof(vol->vol) rejects the valid case where channels exactly equals the array size. Use <= instead.
Reported-by: Pavee Hui <[email protected]> Fixes: 739362d4205c ("audio: add "dbus" audio backend") Signed-off-by: Marc-André Lureau <[email protected]> --- audio/dbusaudio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index e9bdf6adb5bd..7d762fe873cf 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -242,7 +242,7 @@ dbus_volume_out_listener(HWVoiceOut *hw, return; } - assert(vol->channels < sizeof(vol->vol)); + assert(vol->channels <= sizeof(vol->vol)); bytes = g_bytes_new(vol->vol, vol->channels); v_vol = g_variant_new_from_bytes(G_VARIANT_TYPE("ay"), bytes, TRUE); qemu_dbus_display1_audio_out_listener_call_set_volume( @@ -332,7 +332,7 @@ dbus_volume_in_listener(HWVoiceIn *hw, return; } - assert(vol->channels < sizeof(vol->vol)); + assert(vol->channels <= sizeof(vol->vol)); bytes = g_bytes_new(vol->vol, vol->channels); v_vol = g_variant_new_from_bytes(G_VARIANT_TYPE("ay"), bytes, TRUE); qemu_dbus_display1_audio_in_listener_call_set_volume( -- 2.56.0.rc0.29.g47ce80527c56
