[GH-ISSUE #7660] uuid_from_text panics on multi-byte text and accepts a leading + in a group #3318

Open
opened 2026-11-03 04:07:29 +07:00 by bsakaguchi · 5 comments
Owner

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

Originally assigned to: @fy2ne on GitHub.

🤖 Filed by ClickingMaster's AI agent (Claude Code, Claude Sonnet 5.5), not by ClickingMaster personally.

crates/horizon-client-core/src/uuid.rs, uuid_from_text:

let hex: String = s.chars().filter(|c| *c != '-').collect();
if hex.len() != 32 { return None; }
... u32::from_str_radix(&hex[i * 8..i * 8 + 8], 16)

len() counts bytes and the slices are by byte offset, so:

  • Panic: a string with multi-byte characters whose byte length is 32 after removing dashes, e.g. "€€€€€€€€€€aa" (10 x U+20AC + aa), slices inside a character and panics ("byte index 8 is not a char boundary"). Reachable from command input: game/scoreboard.rs target_of_holder passes the scoreboard holder name (/scoreboard players ... <name>) with only a name.len() == 36 check, e.g. €€€€€€€€€€aa----. Also reached through NBT strings (uuid_from_tag, show_entity hover uuid).
  • Wrong accept: from_str_radix accepts a leading +, so +0000001-0000-0000-0000-000000000000 returns Some. Text with a sign is not a UUID.

Expected: None for both. Fix: require every character to be an ASCII hex digit.

Originally created by @ClickingMaster on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7660 Originally assigned to: @fy2ne on GitHub. > 🤖 Filed by ClickingMaster's AI agent (Claude Code, Claude Sonnet 5.5), not by ClickingMaster personally. `crates/horizon-client-core/src/uuid.rs`, `uuid_from_text`: ```rust let hex: String = s.chars().filter(|c| *c != '-').collect(); if hex.len() != 32 { return None; } ... u32::from_str_radix(&hex[i * 8..i * 8 + 8], 16) ``` `len()` counts bytes and the slices are by byte offset, so: - **Panic:** a string with multi-byte characters whose byte length is 32 after removing dashes, e.g. `"€€€€€€€€€€aa"` (10 x U+20AC + `aa`), slices inside a character and panics ("byte index 8 is not a char boundary"). Reachable from command input: `game/scoreboard.rs` `target_of_holder` passes the scoreboard holder name (`/scoreboard players ... <name>`) with only a `name.len() == 36` check, e.g. `€€€€€€€€€€aa----`. Also reached through NBT strings (`uuid_from_tag`, `show_entity` hover `uuid`). - **Wrong accept:** `from_str_radix` accepts a leading `+`, so `+0000001-0000-0000-0000-000000000000` returns `Some`. Text with a sign is not a UUID. Expected: `None` for both. Fix: require every character to be an ASCII hex digit.
Author
Owner

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

🤖 Agent: /claim

<!-- gh-comment-id:6585931037 --> @ClickingMaster commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
Author
Owner

@github-actions[bot] commented on GitHub (Nov 2, 2026):

🤖 Claims: refused, You hold 8 open issues: finish or /unclaim one first. (asked by @ClickingMaster)

<!-- gh-comment-id:6585936152 --> @github-actions[bot] commented on GitHub (Nov 2, 2026): 🤖 Claims: refused, You hold 8 open issues: finish or `/unclaim` one first. (asked by @ClickingMaster)
Author
Owner

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

🤖 Agent: /unclaim

<!-- gh-comment-id:6586138000 --> @ClickingMaster commented on GitHub (Nov 2, 2026): 🤖 Agent: /unclaim
Author
Owner

@github-actions[bot] commented on GitHub (Nov 2, 2026):

🤖 Claims: refused, You don't hold this issue. (asked by @ClickingMaster)

<!-- gh-comment-id:6586299345 --> @github-actions[bot] commented on GitHub (Nov 2, 2026): 🤖 Claims: refused, You don't hold this issue. (asked by @ClickingMaster)
Author
Owner

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

/claim

<!-- gh-comment-id:6586474206 --> @fy2ne commented on GitHub (Nov 2, 2026): /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#3318
No description provided.