[PR #7818] Fix overflow when remote menus reach the spawner scan #7841

Open
opened 2026-11-03 07:25:09 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7818
Author: @finalpantasy
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/7730-remote-menu-spawner-overflow


📝 Commits (2)

  • ab1fd36 Fix overflow in remote spawner distance checks
  • 7480ea6 Apply rustfmt layout to spawner distance chain

📊 Changes

1 file changed (+5 additions, -4 deletions)

View changed files

📝 crates/horizon-client/src/game/spawner.rs (+5 -4)

📄 Description

🤖 Opened by finalpantasy's AI agent (OpenAI Codex, gpt-6.1-sol), not by finalpantasy personally.

What and why

Opening a remote container can put a dummy block entity at (i32::MIN, 0, 0).
The remote spawning scan calculates its distance before filtering entity kinds,
so signed subtraction or abs() can panic in a debug build.

Use unsigned abs_diff for the three coordinates. The existing inclusive
64-block maximum-axis range and entity dispatch stay unchanged. Fixes #7730.

The required attributed claim command
was posted; the repository's bot reported that GitHub refused assignment.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

This fixes Horizon's own dummy-container representation. It changes no spawning
rules, random-call order, or existing distance threshold.

Other projects' code

None. The change uses Horizon's MIT source and Rust's standard integer API;
the boundary expectations are original. i32::abs_diff is stable since Rust 1.60.

Self-check

The exact old distance statements compiled with overflow checks, then failed
three extreme-coordinate tests while three ordinary/boundary tests passed.
The fixed statements pass all six tests, including the dummy menu key, absolute
minimum delta, opposite signed extremes on each axis, distance 64/65, negative
coordinates, and neighbors near integer limits.

The fixed arithmetic passes the six-case GREEN harness. The follow-up commit
applies rustfmt's layout without changing that arithmetic. A separate 4aa/API80
client containing the fix built offline/locked with default features and the dev
profile; source/tool preservation and independent artifact review passed. Three
existing unused-function warnings remain in that local instrumented client.

At head 7480ea68, GitHub checks
passed formatting, lint, and the Rust core/voxel-kernel tests. The launcher job
completed with its unrelated build/test steps skipped. The full local
tools/pr_ready.py self-check has not run; this PR remains a draft.

The separate 4aa/API80 client passed real offscreen opens of both native compressor
menus, clean save/exit, and a separate no-advance reopen. Independent raw and visual
review verified the command journals, original capture dimensions, player inventory,
position and survival state, both machines' physical contents and policy bytes,
and natural shutdown/cleanup. Startup advanced world/day by 45 ticks and the machine
bridges by 42 ticks; the frozen menu flow and final reopen advanced zero ticks.
This is runtime evidence for the separately built older client, not a current-main
full-game replay.

Screenshots

Original offscreen captures of both compressor menus were inspected locally
alongside their command records. No UI layout or asset changes are part of this fix.

🤖 Generated with OpenAI Codex


🔄 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/7818 **Author:** [@finalpantasy](https://github.com/finalpantasy) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/7730-remote-menu-spawner-overflow` --- ### 📝 Commits (2) - [`ab1fd36`](https://github.com/horizon-rust/horizon/commit/ab1fd36784701bc44a63f9936242c140313a8171) Fix overflow in remote spawner distance checks - [`7480ea6`](https://github.com/horizon-rust/horizon/commit/7480ea68adcc4e7151db0d9a0fbd846e18af5076) Apply rustfmt layout to spawner distance chain ### 📊 Changes **1 file changed** (+5 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/spawner.rs` (+5 -4) </details> ### 📄 Description > 🤖 Opened by finalpantasy's AI agent (OpenAI Codex, gpt-6.1-sol), not by finalpantasy personally. ## What and why Opening a remote container can put a dummy block entity at `(i32::MIN, 0, 0)`. The remote spawning scan calculates its distance before filtering entity kinds, so signed subtraction or `abs()` can panic in a debug build. Use unsigned `abs_diff` for the three coordinates. The existing inclusive 64-block maximum-axis range and entity dispatch stay unchanged. Fixes #7730. The required [attributed claim command](https://github.com/horizon-rust/horizon/issues/7730#issuecomment-6587559373) was posted; the repository's bot reported that GitHub refused assignment. ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [x] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference This fixes Horizon's own dummy-container representation. It changes no spawning rules, random-call order, or existing distance threshold. ## Other projects' code None. The change uses Horizon's MIT source and Rust's standard integer API; the boundary expectations are original. `i32::abs_diff` is stable since Rust 1.60. ## Self-check The exact old distance statements compiled with overflow checks, then failed three extreme-coordinate tests while three ordinary/boundary tests passed. The fixed statements pass all six tests, including the dummy menu key, absolute minimum delta, opposite signed extremes on each axis, distance 64/65, negative coordinates, and neighbors near integer limits. The fixed arithmetic passes the six-case GREEN harness. The follow-up commit applies rustfmt's layout without changing that arithmetic. A separate 4aa/API80 client containing the fix built offline/locked with default features and the dev profile; source/tool preservation and independent artifact review passed. Three existing unused-function warnings remain in that local instrumented client. At head `7480ea68`, [GitHub checks](https://github.com/horizon-rust/horizon/actions/runs/41533217031) passed formatting, lint, and the Rust core/voxel-kernel tests. The launcher job completed with its unrelated build/test steps skipped. The full local `tools/pr_ready.py` self-check has not run; this PR remains a draft. The separate 4aa/API80 client passed real offscreen opens of both native compressor menus, clean save/exit, and a separate no-advance reopen. Independent raw and visual review verified the command journals, original capture dimensions, player inventory, position and survival state, both machines' physical contents and policy bytes, and natural shutdown/cleanup. Startup advanced world/day by 45 ticks and the machine bridges by 42 ticks; the frozen menu flow and final reopen advanced zero ticks. This is runtime evidence for the separately built older client, not a current-main full-game replay. ## Screenshots Original offscreen captures of both compressor menus were inspected locally alongside their command records. No UI layout or asset changes are part of this fix. 🤖 Generated with [OpenAI Codex](https://openai.com/codex) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7841
No description provided.