mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #2376] [MERGED] Cap per-entry decompressed size on .charx and .marinara import #5565
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#5565
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2376
Author: @Romuromylus
Created: 6/5/2026
Status: ✅ Merged
Merged: 6/6/2026
Merged by: @Romuromylus
Base:
refactor← Head:fix/zip-decompression-bomb-cap📝 Commits (1)
1c61469Cap per-entry decompressed size on .charx and .marinara import📊 Changes
2 files changed (+84 additions, -18 deletions)
View changed files
📝
src-tauri/src/commands/storage/imports/marinara.rs(+2 -12)📝
src-tauri/src/commands/storage/imports/payloads.rs(+82 -6)📄 Description
Linked issue
Closes #2303
Why this change
read_zip_entrycalledread_to_endwith no size bound, so a malicious.charxor.marinaraarchive with a high-compression-ratio entry could exhaust memory during decompression (zip bomb).marinara.rsonly checked the size after the full read, which is too late.What changed
read_zip_entrywithread_zip_entry_with_limit: it rejects on the declared uncompressed size before allocating, then streams viatake(limit + 1)so the cap holds even if the ZIP header understates the entry — mirroring the existingcopy_limited_profile_zip_asset_with_limithardening inprofile/assets.rs.card.json5 MiB, charx assets 50 MiB, marinaradata.json5 MiB, marinara avatar 20 MiB); remove the now-redundant post-read checks.Refactor impact
Primary owner: Rust imports (
src-tauri/src/commands/storage/imports/)Impact areas reviewed:
payloads.rs(charx) andmarinara.rs(.marinara) call sites.Boundary notes:
Pressure points touched:
payloads.rs,marinara.rs)Validation
pnpm checkpasses before PR push/handoffManual verification notes
cargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace— green, including 4 newread_zip_entry*tests (oversized rejected, within-limit accepted, uncapped read, missing entry).Feature Discoverability
Reason:
Docs and release impact
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.