https://bugs.kde.org/show_bug.cgi?id=528428

            Bug ID: 528428
           Summary: kwin_wayland aborts in ColorPipeline::create
                    (std::clamp assert) when a client sets a PQ image
                    description with all-zero mastering primaries
    Classification: Plasma
           Product: kwin
      Version First 6.8.2
       Reported In:
          Platform: CachyOS
                OS: Linux
            Status: REPORTED
          Severity: crash
          Priority: NOR
         Component: colour-management
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

SUMMARY
KWin crashes (SIGABRT) as soon as Elden Ring switches to HDR under Wine-Wayland
(GE-Proton11-12, NVIDIA). The client sends a parametric image description with
BT.2020 primaries, PQ, all-zero mastering display primaries and no luminance
values. ColorPipeline::create() then ends up with an inverted clamp range and
std::clamp asserts. A client should not be able to crash the compositor.

STEPS TO REPRODUCE
1. Enable HDR on the output (Alienware AW3423DWF, SDR brightness 275 nits, peak
brightness override 455 nits).
2. Start Elden Ring with GE-Proton11-12 and PROTON_ENABLE_WAYLAND=1
PROTON_ENABLE_HDR=1.
3. Press a key on the "press any button" screen.

OBSERVED RESULT
kwin_wayland aborts and restarts. Reproduced 3 times.

EXPECTED RESULT
KWin ignores or rejects the bogus metadata without crashing.

Client-side WAYLAND_DEBUG output right before the crash:

    -> wp_color_manager_v1#123.create_parametric_creator(new id
wp_image_description_creator_params_v1#137)
    -> wp_image_description_creator_params_v1#137.set_primaries_named(6)
    -> wp_image_description_creator_params_v1#137.set_tf_named(11)
    ->
wp_image_description_creator_params_v1#137.set_mastering_display_primaries(0,
0, 0, 0, 0, 0, 0, 0)
    -> wp_image_description_creator_params_v1#137.create(new id
wp_image_description_v1#138)

Backtrace (coredumpctl, identical for all crashes):

    kwin_wayland: /usr/include/c++/16/bits/stl_algo.h:3616: constexpr const
_Tp& std::clamp(...) [with _Tp = double]: Assertion '!(__hi < __lo)' failed.
    #3  std::__glibcxx_assert_fail
    #5  KWin::ColorPipeline::create(std::shared_ptr<ColorDescription> const&,
std::shared_ptr<ColorDescription> const&, RenderingIntent, InputType)
    #6  KWin::Compositor::setupLayers(...)
    #7  KWin::Compositor::composite(KWin::RenderLoop*)

Arch-based builds use _GLIBCXX_ASSERTIONS, so the inverted range aborts here;
other builds may only misrender.

SOFTWARE/OS VERSIONS
Linux: CachyOS, kernel 7.3.1-1-cachyos
KDE Plasma: 6.8.2 (kwin 6.8.2-2.1)
Qt: 6.12.0
Graphics: NVIDIA GeForce RTX 5070 Ti, driver 615.78.08 (open kernel module),
Wayland session

ADDITIONAL INFORMATION
- GE-Proton report with analysis:
https://github.com/GloriousEggroll/proton-ge-custom/issues/932 (GE plans to
sanitize the metadata on their side).
- Related: bug 519000 ("zero is treated as no data"); here zero values crash
KWin itself.
- Workaround: WINE_WAYLAND_HDR_PASSTHROUGH=1.

---
Written with help from an AI assistant (Claude Opus 5.5); tested and checked by
me.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to