[PR #3797] [MERGED] Packs: read deflate entries to their end; skip a bad entry #5221

Closed
opened 2026-11-03 05:11:04 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3797
Author: @Bloodulon
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: pr/packs-overlay


📝 Commits (2)

  • 1ab99be Packs: an unreadable zip entry costs that file, not the whole overlay
  • 27e16c3 Merge origin/main into pr/packs-overlay

📊 Changes

2 files changed (+94 additions, -10 deletions)

View changed files

📝 crates/horizon-client-render/src/packs.rs (+9 -1)
📝 crates/horizon-client-render/src/zip.rs (+85 -9)

📄 Description

🤖 Opened by Bloodulon's AI agent (Qoder), not by Bloodulon personally.

What and why

A server pack can carry a central directory whose compressed sizes do not match its deflate streams — the Nexo-generated pack one server serves through Dropbox does. miniz_oxide refuses input that continues past the end of a deflate stream, so every such entry failed with corrupt deflate stream, the overlay build propagated the first error, and the reload dropped every pack in the stack: the server's models and textures never appeared, and the failure repeated on each join.

  • zip.rs: deflate entries are inflated with flate2's DeflateDecoder, which reads to the end of the stream and ignores both the trailing bytes and the sizes the directory declares. The compressed bytes still size the buffer, and MAX_ENTRY still caps the output, so an entry cannot inflate past the limit.
  • packs.rs: an entry that still fails to read is logged and skipped; it costs that file, not the whole overlay.

Two tests cover the reader: a stream larger than its declared size, and bytes after the stream's end.

Vanilla reference

None: pack loading is Horizon-only code. The reader follows java.util.zip.ZipFile, which inflates an entry's stream to its end instead of trusting the length the directory declares.

Self-check

pr_ready (tools/pr_ready.py --quick on DESKTOP-TL7HN40, against origin/main at b97e39e07, 1 min 51 s)

Check Result
Scope ✅ 2 files, +94 −10
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 423 passed (48 s)
rustfmt ✅ (7 s)
clippy ❌ failed (21 s)
tests: horizon-client-render ✅ 546 passed (9 s)
doc tests ✅ 0 passed (23 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Clippy fails only on pre-existing lints in files this branch does not touch: horizon-world datafix/schema.rs:433 and worldgen/aquifer/noise_based.rs:466 under the locally installed Rust 1.95.0. A scoped run of the touched crate reports only horizon-client-render/src/camera.rs:676, also untouched here.

Screenshots

None: no player-visible surface of its own; the packs in question render only once they load.

  • Allow edits by maintainers

🤖 Generated with Qoder


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3797 **Author:** [@Bloodulon](https://github.com/Bloodulon) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `pr/packs-overlay` --- ### 📝 Commits (2) - [`1ab99be`](https://github.com/horizon-rust/horizon/commit/1ab99bec275f10a22f72ca3ecf86144e53750cab) Packs: an unreadable zip entry costs that file, not the whole overlay - [`27e16c3`](https://github.com/horizon-rust/horizon/commit/27e16c3e0191d63afbac1c1546cfb1abdc00f8a6) Merge origin/main into pr/packs-overlay ### 📊 Changes **2 files changed** (+94 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/packs.rs` (+9 -1) 📝 `crates/horizon-client-render/src/zip.rs` (+85 -9) </details> ### 📄 Description > 🤖 Opened by Bloodulon's AI agent (Qoder), not by Bloodulon personally. ## What and why A server pack can carry a central directory whose compressed sizes do not match its deflate streams — the Nexo-generated pack one server serves through Dropbox does. miniz_oxide refuses input that continues past the end of a deflate stream, so every such entry failed with `corrupt deflate stream`, the overlay build propagated the first error, and the reload dropped every pack in the stack: the server's models and textures never appeared, and the failure repeated on each join. - `zip.rs`: deflate entries are inflated with `flate2`'s `DeflateDecoder`, which reads to the end of the stream and ignores both the trailing bytes and the sizes the directory declares. The compressed bytes still size the buffer, and `MAX_ENTRY` still caps the output, so an entry cannot inflate past the limit. - `packs.rs`: an entry that still fails to read is logged and skipped; it costs that file, not the whole overlay. Two tests cover the reader: a stream larger than its declared size, and bytes after the stream's end. ## Vanilla reference None: pack loading is Horizon-only code. The reader follows `java.util.zip.ZipFile`, which inflates an entry's stream to its end instead of trusting the length the directory declares. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on DESKTOP-TL7HN40, against origin/main at b97e39e07, 1 min 51 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +94 −10 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 423 passed (48 s) | | rustfmt | ✅ (7 s) | | clippy | ❌ failed (21 s) | | tests: horizon-client-render | ✅ 546 passed (9 s) | | doc tests | ✅ 0 passed (23 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Clippy fails only on pre-existing lints in files this branch does not touch: `horizon-world` `datafix/schema.rs:433` and `worldgen/aquifer/noise_based.rs:466` under the locally installed Rust 1.95.0. A scoped run of the touched crate reports only `horizon-client-render/src/camera.rs:676`, also untouched here. ## Screenshots None: no player-visible surface of its own; the packs in question render only once they load. - [x] Allow edits by maintainers 🤖 Generated with Qoder --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:11:04 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5221
No description provided.