Repository navigation
Conversation
…annot overflow the stack (storytold#1128) Psd::tree flattens groups nested deeper than MAX_GROUP_DEPTH into their depth-64 parent, keeping every layer, so the importer recursion and the tree's Drop/Clone/PartialEq are bounded. The import result reports how many groups were flattened. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…amples; no panic in Warp::apply or Rect::new (storytold#1130) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…storytold#1133) One decode_plane for raw/RLE/ZIP (decode_channel and composite), placed::eight and quad_from for the SoLd/PlLd transforms, the writer's big-endian and UTF-16 helpers from descriptor.rs, one delimiter const in engine_data.rs, and the dead binding in write.rs. No behaviour change; adds ZIP and RLE composite tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…stead of failing the document Psd::parse drops the layers, records Psd::warnings and keeps the header and merged image; the importer then imports the flattened image as one layer and reports 'Layers could not be read'. Header damage and a missing merged image stay hard errors. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…quad solves (storytold#1136) Raw channels are borrowed, ZIP planes are un-predicted in place in the inflated buffer, the 32-bit un-predictor uses one scratch row, the layer mask tests the rect per row instead of per pixel (and skips a constant factor of 1.0), and a placed-layer bake solves the quad once and hoists per-triangle invariants. Output is bit-identical; tests compare against the replaced implementations and count the avoided work. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…torytold#1138) The 2^28 pixel limit applied per image; one composite or layer decode kept the ZIP output, a Vec<f32> per channel and the result alive together, and the bake size came from the file's quad. A decode now charges every buffer against a byte budget (4 GiB, 1 GiB on 32-bit), checks its whole expected peak before allocating, writes channels straight into the result and returns an error when over budget. Bakes are at most 4x the document across and 2^24 pixels. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> # Conflicts: # crates/psd/src/tests.rs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> # Conflicts: # crates/engine/src/psd_import.rs # crates/engine/src/tests_vector_import.rs # crates/psd/src/tests.rs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> # Conflicts: # crates/psd/src/tests.rs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> # Conflicts: # crates/psd/src/lib.rs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> # Conflicts: # crates/psd/src/lib.rs # crates/psd/src/placed.rs
…huge header under a small budget, on a 2 MiB stack Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Author
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.
What this is
A pre-resolved view of the six open PSD hardening PRs merged together on top of
upstream/main. Do not merge this PR. Please merge the six single PRs. If you merge them in any order, the later ones can take the conflict resolution from here (the merge commits on this branch show it per PR).MAX_GROUP_DEPTH,tree_report()samples(),f64_finite,Warp::apply), saturatingRect::newPsd::warnings, damaged layer section falls back to the merged imageopen_planes/decode_planeBudget, channels written straight into the resultMerged in that order, one
--no-ffmerge each, rerere on, no rebase.Conflicts and how they were resolved
psd/src/tests.rs(both append tests): kept all tests.engine/src/psd_import.rs: kept both:psd.warningsare added first, then the flatten warning fromtree_report(); an empty layer list with warnings imports the flattened comp, otherwisebuild_compuses thetree_report()tree.engine/src/tests_vector_import.rsandpsd/src/tests.rs: kept all tests of both sides.psd/src/tests.rs: kept all tests.psd/src/lib.rs. One decode path: PSD: share the duplicated decode, placed-transform and writer helpers (#1133) #1134'sopen_planes/decode_plane(withPlaneStream) stay the shared entry points; PSD: avoid redundant plane copies, per-pixel mask tests and repeated quad solves (#1136) #1137's optimisations are built into them:plane_bytesreturnsCow(raw planes borrowed from the file),zip_planeun-predicts in place in the inflated buffer, RLE reading isunpack_plane(keeps PSD: share the duplicated decode, placed-transform and writer helpers (#1133) #1134's checkedcounts.get(), no indexing).decode_channelbecameplane_bytes+samples. The old per-planeto_veccopies of PSD: share the duplicated decode, placed-transform and writer helpers (#1133) #1134 are gone.psd/src/lib.rsandplaced.rs.channel_bytes/plane_bytes/open_planes/decode_plane/unpack_planenow take theBudget: ZIP is charged before inflating (as a whole, inopen_planes), RLE buffers viabudget.vec, raw planes are borrowed and not charged. New helperrelease_bytesreleases only owned buffers.composite_with_budgetandlayer_pixels_with_budgetuse these (no second copy of the ZIP/RLE/raw logic).for_each_sample(from PSD: a memory budget for one decode and a capped smart-object bake (#1138) #1139, replacessamples) now applies PSD: drop non-finite values, no panic in Warp::apply / Rect::new (#1130) #1131's non-finite rule (finite_sample: NaN to 0, +inf to 1, -inf to 0), which the budget rewrite had dropped.scaleversion kept (with its test counter), PSD: a memory budget for one decode and a capped smart-object bake (#1138) #1139's per-pixel loop dropped.placed.rs: kept both sides' tests (PSD: drop non-finite values, no panic in Warp::apply / Rect::new (#1130) #1131's custom-warp test and PSD: a memory budget for one decode and a capped smart-object bake (#1138) #1139's bake-cap tests).Test adaptations (signatures changed by the merge)
tests_opt.rs(PSD: avoid redundant plane copies, per-pixel mask tests and repeated quad solves (#1136) #1137 reference decoders): callref_samples/ref_to_rgb(from PSD: a memory budget for one decode and a capped smart-object bake (#1138) #1139'smemory_tests.rs, nowpub(crate)) becausesamples/to_rgbno longer exist;plane_bytestest passes&mut Budget::new(u64::MAX).memory_tests.rs(PSD: a memory budget for one decode and a capped smart-object bake (#1138) #1139 reference):ref_samplesgot PSD: drop non-finite values, no panic in Warp::apply / Rect::new (#1130) #1131's non-finite rule so "bit for bit equal" still holds for 32-bit data;with_mergedispub(crate).tests.rs(PSD: drop non-finite values, no panic in Warp::apply / Rect::new (#1130) #1131 testnon_finite_32_bit_samples_become_finite): usesfor_each_sample/rgb_frominstead ofsamples/to_rgb.New integration test
crates/psd/src/tests_integration.rs, all on a 2 MiB thread:Commands run (target dir
target/slot5)cargo test -p effectcraft-psdcargo test -p effectcraft-enginecargo test -p effectcraft-mediacargo test -p effectcraft-scriptcargo test -p effectcraft-hostcargo clippy --workspace --all-targets -- -D warningsrelease_bytes, fixed in the last commit)cargo fmt --all --checkcargo xtask layerscargo xtask assetscargo xtask wasmNot run
cargo xtask ci, the full workspace tests, ui-egui tests (no ui code touched), and the known unrelated ui-egui failuretheme::tests::interface_symbols_have_a_glyph_in_every_family.🤖 Generated with Claude Code