]> git.ipfire.org Git - thirdparty/qemu.git/commit
ui/vnc: Fix crash when specifying [vnc] without id in the config file
authorThomas Huth <thuth@redhat.com>
Thu, 21 Aug 2025 14:51:30 +0000 (16:51 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 11 Sep 2025 14:23:11 +0000 (17:23 +0300)
commitd3f77be407b663b26d644681e24ac3676f417c02
tree0946a192d3740bc39531487271cde54ea20180dc
parent5d383e0e3ee53af74cf22e2f04551c9df1899c93
ui/vnc: Fix crash when specifying [vnc] without id in the config file

QEMU currently crashes when there is a [vnc] section in the config
file that does not have an "id = ..." line:

 $ echo "[vnc]" > /tmp/qemu.conf
 $ ./qemu-system-x86_64 -readconfig /tmp/qemu.conf
 qemu-system-x86_64: ../../devel/qemu/ui/vnc.c:4347: vnc_init_func:
  Assertion `id' failed.
 Aborted (core dumped)

The required "id" is only set up automatically while parsing the command
line, but not when reading the options from the config file.
Thus let's move code that automatically adds the id (if it does not
exist yet) to the init function that needs the id for the first time,
replacing the assert() statement there.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2836
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250821145130.845104-1-thuth@redhat.com>
(cherry picked from commit 38dd513263d814dc3cf554b899c118a46ca77577)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
ui/vnc.c