Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Checks if message body is NULL before getting number of children. #349

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

5061726b6572
Copy link

@5061726b6572 5061726b6572 commented Feb 22, 2025

Fixes segmentation fault from calling g_variant_n_children on NULL GVariant*. The body returned by g_dbus_message_get_body can be NULL (https://docs.gtk.org/gio/method.DBusMessage.get_body.html) which is not accounted for in current error handling code.

Thread 1 "playerctld" received signal SIGSEGV, Segmentation fault.
g_bit_lock (address=0x30, lock_bit=0) at ../glib/glib/gbitlock.c:219
219	 __asm__ volatile goto ("lock bts %1, (%0)\n"
(gdb) bt
#0  g_bit_lock (address=0x30, lock_bit=0) at ../glib/glib/gbitlock.c:219
#1  0x00007ffff7e96c93 in g_variant_lock (value=0x0) at ../glib/glib/gvariant-core.c:263
#2  g_variant_n_children (value=0x0) at ../glib/glib/gvariant-core.c:1102
#3  0x000055555555984f in proxy_method_call_async_callback
    (source_object=0x555555568d80 [GDBusConnection], res=0x555555588340, user_data=0x7fffec00dad0)
    at ../playerctl/playerctl-daemon.c:741
#4  0x00007ffff7cc64cc in g_task_return_now (task=0x555555588340 [GTask]) at ../glib/gio/gtask.c:1361
#5  0x00007ffff7cc6515 in complete_in_idle_cb (task=0x555555588340) at ../glib/gio/gtask.c:1375
#6  0x00007ffff7e49559 in g_main_dispatch (context=0x5555555770b0) at ../glib/glib/gmain.c:3357
#7  0x00007ffff7eac257 in g_main_context_dispatch_unlocked (context=0x5555555770b0)
    at ../glib/glib/gmain.c:4208
#8  g_main_context_iterate_unlocked.isra.0
    (context=0x5555555770b0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at ../glib/glib/gmain.c:4273
#9  0x00007ffff7e4a287 in g_main_loop_run (loop=0x55555557e950) at ../glib/glib/gmain.c:4475
#10 0x000055555555c2cc in main (argc=1, argv=0x7fffffffe1d8) at ../playerctl/playerctl-daemon.c:1525

Probably Fixes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant