fix: prevent pixman crashes and ensure valid color management metadata #12674
+304
−152
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
This PR addresses two related issues causing crashes in clients (specifically Chromium/Electron-based applications) due to invalid data being passed from the compositor.
Changes
1. Fix Invalid Pixman Rectangles (Monitor.cpp)
In
CMonitor::addDamage(const CBox& box), a guard clause was added to ignore boxes with non-positive dimensions.Previously, passing a box with
width <= 0orheight <= 0topixman_region32_init_rectcaused an assertion failure or crash with the error:*** BUG *** In pixman_region32_init_rect: Invalid rectangle passed2. Fix Incomplete Image Description (ColorManagement.cpp)
Updated
CColorManagementImageDescriptionInfoand scRGB creation to ensure valid metadata is always sent to clients:primariesare invalid (e.g., zeroed out), the protocol now sends standard sRGB primaries instead of sending invalid data.Impact
This fixes crashes observed in applications logging:
[wayland_wp_image_description.cc] Incomplete image description info from compositorpixman_region32_init_rect: Invalid rectangle passed