Skip to content

Fix compositor crash when passing an invalid keybinding

Guido Gunther requested to merge guido.gunther/phoc:fix-bind-crash into master

Passing an invalid keybinding currently doesn't end well:

     ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0xaaaaadbff580 bp 0xffffc1f94d00 sp 0xffffc1f94d00 T0)
     The signal is caused by a READ memory access.
     Hint: address points to the zero page.
        #0 0xaaaaadbff580 in phosh_private_keyboard_event_accelerator_is_registered ../src/phosh.c:131
        #1 0xaaaaadbff7d8 in phosh_private_accelerator_already_subscribed ../src/phosh.c:149
        #2 0xaaaaadbffa68 in phosh_private_keyboard_event_grab_accelerator_request ../src/phosh.c:184
        #3 0xffffafb47044  (/lib/aarch64-linux-gnu/libffi.so.7+0x6044)
        #4 0xffffafb4676c  (/lib/aarch64-linux-gnu/libffi.so.7+0x576c)
        #5 0xffffb0031a1c in wl_closure_invoke ../src/connection.c:1018
        #6 0xffffb002cd7c in wl_client_connection_data ../src/wayland-server.c:432
        #7 0xffffb002fa64 in wl_event_loop_dispatch ../src/event-loop.c:1027
        #8 0xaaaaadbdce38 in wayland_event_source_dispatch ../src/server.c:42
        #9 0xffffb0273bc4 in g_main_dispatch ../../../glib/gmain.c:3325
        #10 0xffffb0273bc4 in g_main_context_dispatch ../../../glib/gmain.c:4043
        #11 0xffffb0273e58 in g_main_context_iterate ../../../glib/gmain.c:4119
        #12 0xffffb02741ac in g_main_loop_run ../../../glib/gmain.c:4317
        #13 0xaaaaadbdc7f0 in main ../src/main.c:137
        #14 0xffffafd8c214 in __libc_start_main ../csu/libc-start.c:308
        #15 0xaaaaadbdb610  (/usr/bin/phoc+0x1b610)

The rest of the patches just reworks corresponding the test code to be easier readable/extendable.

Merge request reports