fix(xgameruntime): reject non-finite HDR luminance values in hdr::normalize #374

Manually merged
github merged 2 commits from github-bot/gh-374 into main 2026-11-26 14:07:20 +00:00 AGit
Owner

@⁠Lewandox on GitHub · 2026-11-26 13:44 UTC · original
Lewandox:fix/xgameruntime-hdr-non-finite → main · +9 −3 · 1 files · 2 commits · merged 2026-11-26 14:02 UTC

Summary

Fixes hdr::normalize in crates/anyxboxx-xgameruntime/src/hdr.rs allowing f32::INFINITY through as max_tone_map_luminance (and max_full_frame_tone_map_luminance).

Previously, normalize checked min.is_nan() || max.is_nan() || min < 0.0 || max <= min, so a reported (0.01, +inf, 400.0) bypassed all checks and returned max_tone_map_luminance = +inf to the title's tone mapper. Similarly, full_frame == +inf bypassed the fallback check.

Changes

  • crates/anyxboxx-xgameruntime/src/hdr.rs: Use !is_finite() instead of is_nan() for min, max, and full_frame.
  • Added unit test cases for f32::INFINITY and f32::NEG_INFINITY across min, max, and max_full_frame_tone_map_luminance.

Verification

  • cargo fmt -p anyxboxx-xgameruntime -- --check — pass
  • cargo clippy -p anyxboxx-xgameruntime --no-deps --all-targets -- -D warnings — pass
  • cargo test -p anyxboxx-xgameruntime hdr::tests — all passed, 0 failed
**@⁠Lewandox** on GitHub · 2026-11-26 13:44 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/374) `Lewandox:fix/xgameruntime-hdr-non-finite` → `main` · +9 −3 · 1 files · 2 commits · merged 2026-11-26 14:02 UTC ## Summary Fixes `hdr::normalize` in `crates/anyxboxx-xgameruntime/src/hdr.rs` allowing `f32::INFINITY` through as `max_tone_map_luminance` (and `max_full_frame_tone_map_luminance`). Previously, `normalize` checked `min.is_nan() || max.is_nan() || min < 0.0 || max <= min`, so a reported `(0.01, +inf, 400.0)` bypassed all checks and returned `max_tone_map_luminance = +inf` to the title's tone mapper. Similarly, `full_frame == +inf` bypassed the fallback check. ### Changes - **`crates/anyxboxx-xgameruntime/src/hdr.rs`**: Use `!is_finite()` instead of `is_nan()` for `min`, `max`, and `full_frame`. - Added unit test cases for `f32::INFINITY` and `f32::NEG_INFINITY` across `min`, `max`, and `max_full_frame_tone_map_luminance`. ### Verification - `cargo fmt -p anyxboxx-xgameruntime -- --check` — pass - `cargo clippy -p anyxboxx-xgameruntime --no-deps --all-targets -- -D warnings` — pass - `cargo test -p anyxboxx-xgameruntime hdr::tests` — all passed, 0 failed
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 13:49:41 +00:00
github manually merged commit 93e426611b into main 2026-11-26 14:07:20 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.