Commit 23464f3
committed
fix(domain_fronter): fix panic from non-char-boundary slice in error paths
Four error format strings truncated a &str at byte offset 200 using
&text[..text.len().min(200)]. When the response body contains multi-byte
UTF-8 characters (quota error HTML, brotli-compressed or binary Apps
Script responses, cold-start warning pages), byte offset 200 can fall
inside a character boundary, causing a panic and SIGILL core dump.
Replace byte-offset truncation with char-aware truncation via
.chars().take(200).collect::<String>() at all four sites:
- parse_relay_json: "no json in" and "no json end in" messages
- finalize_tunnel_response: "no json in tunnel response" message
- finalize_batch_response: "no json in batch response" message
Reproducible under normal operating conditions when Apps Script
returns a non-JSON body under quota pressure or transient errors.1 parent b4d0f73 commit 23464f3
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3037 | 3037 | | |
3038 | 3038 | | |
3039 | 3039 | | |
3040 | | - | |
| 3040 | + | |
3041 | 3041 | | |
3042 | 3042 | | |
3043 | 3043 | | |
| |||
3205 | 3205 | | |
3206 | 3206 | | |
3207 | 3207 | | |
3208 | | - | |
| 3208 | + | |
3209 | 3209 | | |
3210 | 3210 | | |
3211 | 3211 | | |
| |||
4578 | 4578 | | |
4579 | 4579 | | |
4580 | 4580 | | |
4581 | | - | |
| 4581 | + | |
4582 | 4582 | | |
4583 | 4583 | | |
4584 | 4584 | | |
4585 | 4585 | | |
4586 | 4586 | | |
4587 | | - | |
| 4587 | + | |
4588 | 4588 | | |
4589 | 4589 | | |
4590 | 4590 | | |
| |||
0 commit comments