fix(linux): guard XRandR NULL returns to avoid a SEGV during display setup - #5644
Open
sresarehumantoo wants to merge 1 commit into
Open
fix(linux): guard XRandR NULL returns to avoid a SEGV during display setup#5644sresarehumantoo wants to merge 1 commit into
sresarehumantoo wants to merge 1 commit into
Conversation
…setup XRRGetScreenResources and XRRGetCrtcInfo both return NULL on a transient X error, which happens while the RandR configuration is still settling (for example when a second CRTC is being brought up as a multi-display session starts). Three call sites dereference the result without checking it, so the whole process dies instead of reporting a failure the caller can retry. Check all three: both x11_attr_t::init() and x11_display_names() bail out the way the adjacent xdisplay failures already do, and the CRTC lookup falls through to the existing "record the entire virtual desktop" path. Observed on a two-display session that raced CRTC bring-up, where sunshine would SEGV on session start and succeed on retry.
|
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.



Description
XRRGetScreenResources and XRRGetCrtcInfo return NULL on a transient X error. There are three call sites in src/platform/linux/x11grab.cpp that dereference without checking:
Trigger: RandR config still settling, ex: a second CRTC comes up as a multi-display session starts. Result is a process-wide SEGV.
What I saw: sunshine SEGVs on session start with two displays, succeeds on retry. Found and fixed in my own tree in July; running on my test bench (vdi-test, Debian 13 (trixie)) since.
Verified on Ubuntu 22.04 WSL2 that it builds clean against master (393/393). Unit tests show no new failures (MouseHIDTest and EncoderTest fail identically before and after the patch in that environment, because it has no /dev/uinput; 0 failed tests either way).
Screenshot
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage
See our AI usage policy.