]> 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)
committerThomas Huth <thuth@redhat.com>
Tue, 9 Sep 2025 07:37:49 +0000 (09:37 +0200)
commit38dd513263d814dc3cf554b899c118a46ca77577
tree0364a44a4f10eb514a62f60f6076ae7885c5ba74
parent2dbaf58bbe78f415ec867dc238f90321ed8a3f62
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>
ui/vnc.c