Skip to content

fix: cap expanded 3MF archive size - #28

Closed
Jozkah wants to merge 3 commits into
CNCKitchen:mainfrom
Jozkah:fix/3mf-archive-limits
Closed

Jozkah wants to merge 3 commits into
CNCKitchen:mainfrom
Jozkah:fix/3mf-archive-limits

Conversation

@Jozkah

@Jozkah Jozkah commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Bound 3MF archive expansion before fflate allocates entry contents.

Why

Compressed 3MF files can declare very large expanded entries or excessive member counts. Parsing such input without limits can exhaust browser memory.

Changes

  • Limit archives to 512 members.
  • Limit one expanded entry to 256 MiB.
  • Limit total expanded contents to 512 MiB.
  • Apply limits to model parsing and packed texture scanning.
  • Add regression coverage for oversized expanded contents.

Verification

  • npm test -- --reporter=dot --maxWorkers=2: 3,085 passed; 24 skipped
  • npm run build: passed, including tsc --noEmit

Risk

Ordinary 3MF files are unaffected. Files beyond supported limits now fail with a specific error.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. Thank you.
Posted by the CLA Assistant Lite bot.

@Jozkah

Jozkah commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

I agree to CLA.md

A stored member comes out as large as its stored bytes whatever size it
declares, so the limit now takes the larger of the two. Only the members
read count towards the total, and the per-member cap is raised to 512 MB:
256 MB turned away 3MF scans of a few million triangles that opened before.
@Jozkah

Jozkah commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Closing: the 3MF archive size limits landed in 0.9.6 (https://github.com/CNCKitchen/ScanRuler/releases/tag/v0.9.6). Thanks for taking it in.

@Jozkah Jozkah closed this Nov 8, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant