Repository navigation
Conversation
The Wayland screen plugin calls wl_cleanup() from the error path before display.outputs is initialized. On GNOME Wayland (no wlr-screencopy support) fetch_wl_display() fails and wl_cleanup() walks an uninitialized list, crashing clightd with SIGSEGV. Initialize the list before fetching the display and make cleanup tolerate partially initialized outputs (frame, buffer, wl_output). Also reject invalid frame geometry in rgb_frame_brightness() instead of dividing by zero.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix a SIGSEGV in the Wayland screen plugin when the compositor does not
support
wlr-screencopy-unstable-v1(GNOME Wayland).Root cause
get_frame_brightness()callsfetch_wl_display()before initializingdisplay.outputs. When the Wayland connect fails, it jumps toerrandwl_cleanup()walks the uninitializedwl_list, crashing clightd.wl_cleanup()also dereferencesoutput->frame,output->bufferandoutput->wl_outputunconditionally.Reproduction
On GNOME Wayland:
Before: clightd exits with SIGSEGV (
get_frame_brightnessin the stack).After: the call returns
Compositor does not support 'wlr-screencopy-unstable-v1' protocoland clightd keeps running.
Changes
display.outputsbeforefetch_wl_display().frame,bufferandwl_outputinwl_cleanup(); freeframe.rgb_frame_brightness().Testing
Built with
-DENABLE_GAMMA=ON -DENABLE_DPMS=ON -DENABLE_SCREEN=ONonFedora 45 (GCC 16) against libmodule 5.0.2; tested on MacBookPro12,1
(GNOME Wayland). X11 path is unaffected.