[GH-ISSUE #7196] Scoreboard division panics for -2147483648 divided by -1 #3173

Closed
opened 2026-11-03 04:06:26 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @TheMrZZ on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7196

Originally assigned to: @TheMrZZ on GitHub.

🤖 Filed by TheMrZZ's AI agent (T3 Code / Codex, gpt-6-astra), not by TheMrZZ personally.

On current main 9eb0e230e34836c8c1e567593bc7123e66475f66, scoreboard division of -2147483648 by -1 panics in scoreboard_cmd::apply_operation.

Reproduction commands:

scoreboard objectives add poc dummy
scoreboard players set target poc -2147483648
scoreboard players set divisor poc -1
scoreboard players operation target poc /= divisor poc
scoreboard players get target poc

Expected: target remains -2147483648 and the server remains alive. A fresh official Java Edition 26.3 server on this Mac returned target has -2147483648 [poc], then processed stop normally. The official server jar SHA-1 is 33680f5f2ac32864d6d7cf5e56a705fdb3e05f4c, matching research-lock.json.

Actual: the division uses wrapping_div, but its floor-rounding condition evaluates a % b, which panics for this pair. Independently reproduced today with the exact current-main function compiled using rustc -O: attempt to calculate the remainder with overflow. This is a function-level current-main reproduction, not a fresh full Horizon server run. The earlier audit reproduced the server panic on 58312968a8881c3737e57ca95d905e658e950ada with the fast profile.

Vanilla bytecode: OperationArgument.getSimpleOperation division calls Mth.floorDiv, which calls Math.floorDiv.

Scope: division only. The separate large-divisor remainder behavior is excluded. Existing signed-division unit tests omit this boundary. No other project's implementation source was used.

Confirmed with a command-level regression in the existing unit-test module on the same main source: division_wraps_minimum_integer_by_negative_one fails at scoreboard_cmd.rs:792:48 with the remainder-overflow panic. With only the remainder check changed to wrapping_rem, all seven scoreboard command tests and the full library suite (1,385 passed, 48 ignored) pass.

Originally created by @TheMrZZ on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7196 Originally assigned to: @TheMrZZ on GitHub. > 🤖 Filed by TheMrZZ's AI agent (T3 Code / Codex, gpt-6-astra), not by TheMrZZ personally. On current main `9eb0e230e34836c8c1e567593bc7123e66475f66`, scoreboard division of `-2147483648` by `-1` panics in `scoreboard_cmd::apply_operation`. Reproduction commands: ``` scoreboard objectives add poc dummy scoreboard players set target poc -2147483648 scoreboard players set divisor poc -1 scoreboard players operation target poc /= divisor poc scoreboard players get target poc ``` Expected: target remains `-2147483648` and the server remains alive. A fresh official Java Edition 26.3 server on this Mac returned `target has -2147483648 [poc]`, then processed `stop` normally. The official server jar SHA-1 is `33680f5f2ac32864d6d7cf5e56a705fdb3e05f4c`, matching research-lock.json. Actual: the division uses `wrapping_div`, but its floor-rounding condition evaluates `a % b`, which panics for this pair. Independently reproduced today with the exact current-main function compiled using `rustc -O`: `attempt to calculate the remainder with overflow`. This is a function-level current-main reproduction, not a fresh full Horizon server run. The earlier audit reproduced the server panic on `58312968a8881c3737e57ca95d905e658e950ada` with the fast profile. Vanilla bytecode: `OperationArgument.getSimpleOperation` division calls `Mth.floorDiv`, which calls `Math.floorDiv`. Scope: division only. The separate large-divisor remainder behavior is excluded. Existing signed-division unit tests omit this boundary. No other project's implementation source was used. Confirmed with a command-level regression in the existing unit-test module on the same main source: `division_wraps_minimum_integer_by_negative_one` fails at `scoreboard_cmd.rs:792:48` with the remainder-overflow panic. With only the remainder check changed to `wrapping_rem`, all seven scoreboard command tests and the full library suite (1,385 passed, 48 ignored) pass.
Author
Owner

@TheMrZZ commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6577324379 --> @TheMrZZ commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
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#3173
No description provided.