core: Avoid generating XEvent from uninitialized data
The uninitialized fields in this event causes use of uninitialised data as seen in valgrind: ==71864== Syscall param writev(vector[0]) points to uninitialised byte(s) ==71864== at 0x5026EBD: __writev (writev.c:26) ==71864== by 0x5026EBD: writev (writev.c:24) ==71864== by 0x6482A3B: UnknownInlinedFun (xcb_conn.c:296) ==71864== by 0x6482A3B: _xcb_conn_wait.part.0 (xcb_conn.c:551) ==71864== by 0x6482BAF: UnknownInlinedFun (xcb_out.c:469) ==71864== by 0x6482BAF: _xcb_out_send (xcb_out.c:470) ==71864== by 0x6483DD7: UnknownInlinedFun (xcb_out.c:416) ==71864== by 0x6483DD7: xcb_writev (xcb_out.c:409) ==71864== by 0x53B79B4: _XSend (xcb_io.c:587) ==71864== by 0x53BBF38: _XReply (xcb_io.c:679) ==71864== by 0x53AFFC9: XQueryTree (QuTree.c:47) ==71864== by 0x4982A5F: query_xserver_stack (stack-tracker.c:508) ==71864== by 0x4EA1F5F: g_closure_invoke (gclosure.c:832) ==71864== by 0x4ECFD45: signal_emit_unlocked_R.isra.0 (gsignal.c:3796) ==71864== by 0x4EC0129: g_signal_emit_valist (gsignal.c:3549) ==71864== by 0x4EC03B2: g_signal_emit (gsignal.c:3606) ==71864== Address 0x287d5900 is 32 bytes inside a block of size 16,384 alloc'd ==71864== at 0x4849444: calloc (vg_replace_malloc.c:1340) ==71864== by 0x53A5FE8: XOpenDisplay (OpenDis.c:240) ==71864== by 0x6100E3C: _gdk_x11_display_open (gdkdisplay-x11.c:1565) ==71864== by 0x60CF675: gdk_display_manager_open_display (gdkdisplaymanager.c:462) ==71864== by 0x49D59F1: open_gdk_display (meta-x11-display.c:1041) ==71864== by 0x49D5D64: meta_x11_display_new (meta-x11-display.c:1156) ==71864== by 0x49564AD: meta_display_init_x11_finish (display.c:743) ==71864== by 0x495679D: on_x11_initialized (display.c:818) ==71864== by 0x4D67558: g_task_return_now (gtask.c:1232) ==71864== by 0x4D67782: UnknownInlinedFun (gtask.c:1301) ==71864== by 0x4D67782: g_task_return (gtask.c:1258) ==71864== by 0x495663C: on_xserver_started (display.c:788) ==71864== by 0x4D67558: g_task_return_now (gtask.c:1232) ==71864== Uninitialised value was created by a stack allocation ==71864== at 0x49D4A59: take_manager_selection (meta-x11-display.c:640) ==71864== To fix this, fully initialize the event struct before sending it. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2535 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2724>
This commit is contained in:
parent
20bf7f5ceb
commit
7a103bbfe9
@ -688,7 +688,7 @@ take_manager_selection (MetaX11Display *x11_display,
|
|||||||
|
|
||||||
{
|
{
|
||||||
/* Send client message indicating that we are now the selection owner */
|
/* Send client message indicating that we are now the selection owner */
|
||||||
XClientMessageEvent ev;
|
XClientMessageEvent ev = { 0, };
|
||||||
|
|
||||||
ev.type = ClientMessage;
|
ev.type = ClientMessage;
|
||||||
ev.window = xroot;
|
ev.window = xroot;
|
||||||
|
Loading…
Reference in New Issue
Block a user