Skip to content

Conversation

@Watchdog0x
Copy link

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 <= 0 or height <= 0 to pixman_region32_init_rect caused an assertion failure or crash with the error:
*** BUG *** In pixman_region32_init_rect: Invalid rectangle passed

2. Fix Incomplete Image Description (ColorManagement.cpp)

Updated CColorManagementImageDescriptionInfo and scRGB creation to ensure valid metadata is always sent to clients:

  • Fallback Primaries: If primaries are invalid (e.g., zeroed out), the protocol now sends standard sRGB primaries instead of sending invalid data.
  • scRGB Luminance: Hardcoded valid default luminance values (min: 0.0001, ref: 80, max: 600) for Windows scRGB generation to satisfy strict client validation.

Impact

This fixes crashes observed in applications logging:

  • [wayland_wp_image_description.cc] Incomplete image description info from compositor
  • pixman_region32_init_rect: Invalid rectangle passed

@github-actions
Copy link

Hello and thank you for making a PR to Hyprland!

Please check the PR Guidelines and make sure your PR follows them.
It will make the entire review process faster. :)

If your code can be tested, please always add tests. See more here.

beep boop, I'm just a bot. A real human will review your PR soon.

Copy link
Contributor

@Honkazel Honkazel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welp...

@Watchdog0x
Copy link
Author

This update adopts modern C++ standards (C++17/20/23) to strengthen the security and robustness of the Color Management protocol implementation through safer type manipulation.

It also introduces additional security features, such as applying const correctness to methods and variables to avoid unintended state changes.

@UjinT34
Copy link
Contributor

UjinT34 commented Dec 18, 2025

Other CM changes are mostly some refactoring and code style changes that shouldn't affect how the proto works but might not match the rest of the codebase.

@Watchdog0x
Copy link
Author

Don’t merge this. Code is a piece of shit (confirmed by bugs).

@Watchdog0x Watchdog0x closed this Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants