[PR #3907] [MERGED] Reject recipe result counts outside 1..=99 (Fixes #3884) #5284

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

📋 Pull Request Information

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

Base: main ← Head: fix/issue-3884-recipe-count-range


📝 Commits (1)

  • 2403ca4 Reject data-pack recipe result counts outside 1..=99

📊 Changes

2 files changed (+47 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/crafting.rs (+34 -1)
📝 crates/horizon-client/src/stations.rs (+13 -8)

📄 Description

🤖 Opened by DUzzL's AI agent, not by DUzzL personally.

Fixes #3884

Recipe result.count was read with as_u64() as u32, so a data pack could produce count 0, 2^31 or a wrapped 2^32 stack. Vanilla's ItemStackTemplate.CODEC uses intRange(1, 99) and the recipe then fails to load.

  • crafting.rs: new template_count (absent = 1, otherwise an integer in 1..=99); Template::parse returns None otherwise. This covers crafting, smithing-style templates and cooking results.
  • stations.rs: the stonecutting loader uses the same check.
  • Test: crafting::tests::result_count_is_bounded_like_vanilla.

The issue also mentions a brewing loader; no such loader exists in this tree (brewing is not data-driven here), so nothing to change there.

Tests: cargo test -p horizon-client --lib crafting:: and stations:: pass, clippy -D warnings clean on horizon-client lib. Harnesses were not run (no .local/ vanilla data).


🔄 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/3907 **Author:** [@DUzzL](https://github.com/DUzzL) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/issue-3884-recipe-count-range` --- ### 📝 Commits (1) - [`2403ca4`](https://github.com/horizon-rust/horizon/commit/2403ca40a29a70a856a2437abb37fdf387f97b54) Reject data-pack recipe result counts outside 1..=99 ### 📊 Changes **2 files changed** (+47 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/crafting.rs` (+34 -1) 📝 `crates/horizon-client/src/stations.rs` (+13 -8) </details> ### 📄 Description > 🤖 Opened by DUzzL's AI agent, not by DUzzL personally. Fixes #3884 Recipe `result.count` was read with `as_u64() as u32`, so a data pack could produce count 0, 2^31 or a wrapped 2^32 stack. Vanilla's `ItemStackTemplate.CODEC` uses `intRange(1, 99)` and the recipe then fails to load. - `crafting.rs`: new `template_count` (absent = 1, otherwise an integer in 1..=99); `Template::parse` returns `None` otherwise. This covers crafting, smithing-style templates and cooking results. - `stations.rs`: the stonecutting loader uses the same check. - Test: `crafting::tests::result_count_is_bounded_like_vanilla`. The issue also mentions a brewing loader; no such loader exists in this tree (brewing is not data-driven here), so nothing to change there. Tests: `cargo test -p horizon-client --lib crafting::` and `stations::` pass, clippy `-D warnings` clean on horizon-client lib. Harnesses were not run (no `.local/` vanilla data). --- <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:29 +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#5284
No description provided.