You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
truncate_iso_date byte-index slice panics on multi-byte UTF-8 input #3444
Split off from #2954 (per @HetCreep's audit at v0.44.2) — the original Cyrillic panic in gain.rs is fixed, but the same byte-vs-char-boundary shape survives in src/core/utils.rs:
pubfntruncate_iso_date(date:&str) -> &str{if date.len() >= 10{&date[..10]}else{ date }}
date.len() is a byte count; &date[..10] is a byte index. Any string with a multi-byte UTF-8 character before byte offset 10 panics instead of truncating.
Reached from 7 call sites in src/cmds/cloud/aws_cmd.rs (lines 649, 674, 782, 869, 960, 999, 1301), each fed a date field off an AWS-style JSON response — i.e. reachable from real API output, not just adversarial input.
Live repro (standalone, same function body):
fntruncate_iso_date(date:&str) -> &str{if date.len() >= 10{&date[..10]}else{ date }}fnmain(){let s = "2024-01-1\u{00e9}5T10:30:00Z";// é lands byte 9..11println!("{}", truncate_iso_date(s));}
thread 'main' panicked at repro.rs:2:32:
end byte index 10 is not a char boundary; it is inside 'é' (bytes 9..11 of string)
Confirmed exit code 101, matches current develop (3044911).
Suggested fix: same pattern already used correctly elsewhere in-tree — gain.rs:730 and session_cmd.rs:113 both use str::floor_char_boundary. e.g.:
(Credit: @HetCreep's source audit on #2954 first identified this while confirming the original issue was fixed — filing separately per their suggestion since it's a distinct call site/bug from the original report.)
byte-index slice in truncate_iso_date (src/core/utils.rs) panics on multi-byte UTF-8 dates reachable from real AWS JSON responses via 7 call sites in aws_cmd.rs; fix with str::floor_char_boundary as already used in gain.rs/session_cmd.rs
This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.
📁 Relevant files
src/core/utils.rs
src/cmds/cloud/aws_cmd.rs
Triaged automatically by wshm · This is an automated analysis, not a human review.
Activity
pszymkowiak commentedon Aug 5, 2026
🔍 Automated Triage
bughighSummary
byte-index slice in truncate_iso_date (src/core/utils.rs) panics on multi-byte UTF-8 dates reachable from real AWS JSON responses via 7 call sites in aws_cmd.rs; fix with str::floor_char_boundary as already used in gain.rs/session_cmd.rs
📁 Relevant files
src/core/utils.rssrc/cmds/cloud/aws_cmd.rsTriaged automatically by wshm · This is an automated analysis, not a human review.