Crash in gapplication.c:1014 when reading error message if dbus_register returns false without setting error
@smspillaz
Submitted by Sam Spilsbury Link to original bug (#769778)
Description
Failing to set an error when dbus_register returns false (or a false-like value, such as undefined from within gjs) will cause gapplication to crash later on.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff4175e54 in g_application_real_local_command_line (application=0x723090,
arguments=0x7fffffffcf90, exit_status=0x7fffffffcf8c) at gapplication.c:1014
1014 g_printerr ("Failed to register: %s\n", error->message);
(gdb) print error
$1 = (GError *) 0x0
(gdb) bt
#0 0x00007ffff4175e54 in g_application_real_local_command_line (application=0x723090,
arguments=0x7fffffffcf90, exit_status=0x7fffffffcf8c) at gapplication.c:1014
#1 0x00007ffff417616a in g_application_run (application=0x723090, argc=<optimized out>, argv=0x7239d0)
at gapplication.c:2350
#2 0x00007ffff65d0ba0 in ffi_call_unix64 () from /lib/x86_64-linux-gnu/libffi.so.6
#3 0x00007ffff65d0608 in ffi_call () from /lib/x86_64-linux-gnu/libffi.so.6
#4 0x00007ffff761126a in ?? () from /lib/libgjs.so.0
#5 0x00007ffff761276f in ?? () from /lib/libgjs.so.0
#6 0x00007ffff39c8ffc in ?? () from /lib/x86_64-linux-gnu/libmozjs-24.so.0
#7 0x00007ffff39cf7dc in ?? () from /lib/x86_64-linux-gnu/libmozjs-24.so.0
#8 0x00007ffff39d5a69 in ?? () from /lib/x86_64-linux-gnu/libmozjs-24.so.0
#9 0x00007ffff39d6993 in ?? () from /lib/x86_64-linux-gnu/libmozjs-24.so.0
#10 0x00007ffff3a87a4d in JS::Evaluate(JSContext*, JS::Handle<JSObject*>, JS::CompileOptions, unsigned short const*, unsigned long, JS::Value*) () from /lib/x86_64-linux-gnu/libmozjs-24.so.0
#11 0x00007ffff3a87b5c in JS::Evaluate(JSContext*, JS::Handle<JSObject*>, JS::CompileOptions, char const*, unsigned long, JS::Value*) () from /lib/x86_64-linux-gnu/libmozjs-24.so.0
#12 0x00007ffff76047b6 in gjs_eval_with_scope () from /lib/libgjs.so.0
#13 0x00007ffff75fd313 in gjs_context_eval () from /lib/libgjs.so.0
#14 0x00000000004011b2 in main ()
This is partially a programmer error, but for the sake of debuggability, at least set an error message stating what happened.
Version: 2.49.x