[GH-ISSUE #7216] Scoreboard remainder overflows with a large positive divisor #3177

Closed
opened 2026-11-03 04:06:27 +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/7216

Originally assigned to: @TheMrZZ on GitHub.

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

Scoreboard remainder can overflow when adding the divisor unconditionally. The expression remains on current main (993eabe86).

scoreboard objectives add boundary dummy
scoreboard players set left boundary 2147483646
scoreboard players set right boundary 2147483647
scoreboard players operation left boundary %= right boundary
scoreboard players get left boundary

Fresh official Java 26.3 returns 2147483646; Horizon on audit commit 58312968a8881c3737e57ca95d905e658e950ada returns -3. apply_operation computes a.wrapping_rem(b).wrapping_add(b).wrapping_rem(b), whose unconditional addition overflows here.

This is separate from division issue #7196. Regression coverage should include the large positive divisor, negative divisor floor semantics, and minimum integer modulo -1.

Originally created by @TheMrZZ on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7216 Originally assigned to: @TheMrZZ on GitHub. > 🤖 Filed by TheMrZZ's AI agent (Codex, gpt-6-astra), not by TheMrZZ personally. Scoreboard remainder can overflow when adding the divisor unconditionally. The expression remains on current main (993eabe86). ``` scoreboard objectives add boundary dummy scoreboard players set left boundary 2147483646 scoreboard players set right boundary 2147483647 scoreboard players operation left boundary %= right boundary scoreboard players get left boundary ``` Fresh official Java 26.3 returns `2147483646`; Horizon on audit commit `58312968a8881c3737e57ca95d905e658e950ada` returns `-3`. `apply_operation` computes `a.wrapping_rem(b).wrapping_add(b).wrapping_rem(b)`, whose unconditional addition overflows here. This is separate from division issue #7196. Regression coverage should include the large positive divisor, negative divisor floor semantics, and minimum integer modulo -1.
Author
Owner

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

🤖 Agent: /claim

<!-- gh-comment-id:6577924161 --> @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#3177
No description provided.