mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-20 00:15:01 +02:00
* Bound layer-group nesting at import and Group Layers (stack-overflow guard) Everything that walks the layer tree (Document::walk behind nearly every command, the layers panel, PSD export, .pcraft save/load) recurses once per level, but nothing bounded how deep a document could get: a PSD whose records nest groups a few thousand deep (each level costs only a divider + folder record pair) overflowed the stack in the importer's build recursion, in apply_link_groups, and again in every consumer - an abort no panic hook or fuzz run catches. The one cap that existed lived in the .pcraft save path (MAX_GROUP_DEPTH = 100), so such a file even imported 'fine' and then bricked saving. - photocraft-doc now owns the limit (MAX_GROUP_DEPTH = 100, the value the format crate already enforced) plus Document::max_group_depth(), an iterative depth measure that cannot itself overflow. - PSD/PSB import rejects files nested deeper than the cap with an actionable Unsupported error, mirroring what the .pcraft loader already does; the never-fail psd_to_document keeps working on such files by capping the recursion and warning about the unimported remainder (this was the overflow). - apply_link_groups (resource 1026) recurses over the same tree and is bounded the same way. - layer.groupLayers refuses to nest past the cap (checked inside the edit, so a rejected call records no history step and leaves the document untouched). * Enforce the group nesting cap in layer.moveTo and Artboard from Layers Moving a group beside or into a deeply nested layer, or wrapping a deep group in an artboard, could still build a tree deeper than MAX_GROUP_DEPTH. A shared check_group_depth helper now rejects those edits with an error and records no history step, like layer.groupLayers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Brandon Thomas <echelon@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| fuzz | ||
| src | ||
| tests | ||
| Cargo.toml | ||