Repository navigation
PSD: drop non-finite values, no panic in Warp::apply / Rect::new (#1130) - #1131
Merged
h-a-n-a-s-h-i merged 1 commit intoOct 13, 2026
Merged
Conversation
…amples; no panic in Warp::apply or Rect::new (storytold#1130) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 12, 2026
Merged
Member
|
Merged. Thank you for the contribution, @vangel76! It landed on |
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.
Fixes #1130
Cause
str::parse::<f64>(), which acceptsnan/inf/-inf; descriptor doubles, theTyShtransform, thePlLdquad,expAf32 values and 32-bit samples were taken as read. The importer forwarded them to font size, tracking, leading, position and scale.Warp::applyindexedmeshdirectly (publiccols/rows/mesh, invariant only checked inWarp::read), andRect::newadded without overflow handling.Changes
None); font size must be > 0 and is capped at 10 000, tracking and leading are clamped to +-100 000.doub/UntF/UnFlandPlLdread non-finite as 0 (Reader::f64_finite); aTyShtransform with a non-finite entry becomes the identity;expAfalls back to exposure 0, offset 0, gamma 1.samples()(32-bit): NaN -> 0, +inf -> 1.0 (white, like the maximum of the integer depths), -inf -> 0.psd_import.rs):set_vec2/set_scalarignore non-finite values,text_docguards scale, size, leading and box.Warp::mesh_pointreturnsOptionusingget()and saturating/checked math,applyleaves the point unchanged for a missing or short mesh or zero/hugecols/rows;Warp::readcomputes(3c+1)(3r+1)with checked math.Rect::newsaturates.Tests (each fails without its fix, verified by temporarily reverting)
engine_data::tests::non_finite_and_out_of_range_numbers_are_not_numberstests::non_finite_transform_and_exposure_values_are_dropped,tests::non_finite_32_bit_samples_become_finite,tests::rect_new_near_i32_max_saturatesplaced::tests::custom_warp_with_a_missing_or_short_mesh_does_not_panicpsd_import::tests::non_finite_text_values_never_reach_the_layer(engine)Commands run
cargo test -p effectcraft-psd,cargo test -p effectcraft-engine,cargo test -p effectcraft-media layeredcargo clippy --workspace --all-targets -- -D warnings,cargo fmt --allcargo xtask layers,cargo check --target wasm32-unknown-unknown -p effectcraft-psd -p effectcraft-engineNot run:
cargo xtask cias a whole, the ui-egui tests, the full workspace test suite.Left out
🤖 Generated with Claude Code