mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
Variables on the stack are released when the parent block is closed.
Here, `now` is used outside of the `if` block, causing the following
crash when starting Sway with the headless backend:
==49606==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7fff94645f90 at pc 0x5558aeae9e29 bp 0x7fff94645df0 sp 0x7fff94645de0
READ of size 16 at 0x7fff94645f90 thread T0
#0 0x5558aeae9e28 in handle_present ../sway/desktop/output.c:834
#1 0x7fdc8d6792fb in wlr_signal_emit_safe ../subprojects/wlroots/util/signal.c:29
#2 0x7fdc8d54f77f in wlr_output_send_present ../subprojects/wlroots/types/output/output.c:766
#3 0x7fdc8d524a28 in output_commit ../subprojects/wlroots/backend/headless/output.c:71
#4 0x7fdc8d54d2db in wlr_output_commit ../subprojects/wlroots/types/output/output.c:629
#5 0x5558aeb013cb in output_render ../sway/desktop/render.c:1157
#6 0x5558aeae549e in output_repaint_timer_handler ../sway/desktop/output.c:544
#7 0x5558aeae5f8a in damage_handle_frame ../sway/desktop/output.c:606
#8 0x7fdc8d6792fb in wlr_signal_emit_safe ../subprojects/wlroots/util/signal.c:29
#9 0x7fdc8d6007d5 in output_handle_frame ../subprojects/wlroots/types/wlr_output_damage.c:44
#10 0x7fdc8d6792fb in wlr_signal_emit_safe ../subprojects/wlroots/util/signal.c:29
#11 0x7fdc8d54ee84 in wlr_output_send_frame ../subprojects/wlroots/types/output/output.c:720
#12 0x7fdc8d54efc3 in schedule_frame_handle_idle_timer ../subprojects/wlroots/types/output/output.c:728
#13 0x7fdc8c9dcf5a in wl_event_loop_dispatch_idle (/usr/lib/libwayland-server.so.0+0xaf5a)
#14 0x7fdc8c9dcfb4 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xafb4)
#15 0x7fdc8c9dabc6 in wl_display_run (/usr/lib/libwayland-server.so.0+0x8bc6)
#16 0x5558aeac8e30 in server_run ../sway/server.c:285
#17 0x5558aeac3c7d in main ../sway/main.c:396
#18 0x7fdc8be35b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#19 0x5558aea8686d in _start (/home/simon/src/sway/build/sway/sway+0x33f86d)
|
||
|---|---|---|
| .. | ||
| data_device | ||
| output | ||
| scene | ||
| seat | ||
| tablet_v2 | ||
| xdg_shell | ||
| meson.build | ||
| wlr_buffer.c | ||
| wlr_compositor.c | ||
| wlr_cursor.c | ||
| wlr_data_control_v1.c | ||
| wlr_drm.c | ||
| wlr_drm_lease_v1.c | ||
| wlr_export_dmabuf_v1.c | ||
| wlr_foreign_toplevel_management_v1.c | ||
| wlr_fullscreen_shell_v1.c | ||
| wlr_gamma_control_v1.c | ||
| wlr_idle.c | ||
| wlr_idle_inhibit_v1.c | ||
| wlr_input_device.c | ||
| wlr_input_inhibitor.c | ||
| wlr_input_method_v2.c | ||
| wlr_keyboard.c | ||
| wlr_keyboard_group.c | ||
| wlr_keyboard_shortcuts_inhibit_v1.c | ||
| wlr_layer_shell_v1.c | ||
| wlr_linux_dmabuf_v1.c | ||
| wlr_matrix.c | ||
| wlr_output_damage.c | ||
| wlr_output_layout.c | ||
| wlr_output_management_v1.c | ||
| wlr_output_power_management_v1.c | ||
| wlr_pointer.c | ||
| wlr_pointer_constraints_v1.c | ||
| wlr_pointer_gestures_v1.c | ||
| wlr_presentation_time.c | ||
| wlr_primary_selection.c | ||
| wlr_primary_selection_v1.c | ||
| wlr_region.c | ||
| wlr_relative_pointer_v1.c | ||
| wlr_screencopy_v1.c | ||
| wlr_server_decoration.c | ||
| wlr_surface.c | ||
| wlr_switch.c | ||
| wlr_tablet_pad.c | ||
| wlr_tablet_tool.c | ||
| wlr_text_input_v3.c | ||
| wlr_touch.c | ||
| wlr_viewporter.c | ||
| wlr_virtual_keyboard_v1.c | ||
| wlr_virtual_pointer_v1.c | ||
| wlr_xcursor_manager.c | ||
| wlr_xdg_activation_v1.c | ||
| wlr_xdg_decoration_v1.c | ||
| wlr_xdg_foreign_registry.c | ||
| wlr_xdg_foreign_v1.c | ||
| wlr_xdg_foreign_v2.c | ||
| wlr_xdg_output_v1.c | ||