Commit d3d41e9
committed
fix(domain_fronter): prevent panic when brace positions are inverted in fallback JSON extraction
In three error-path fallback sites (finalize_tunnel_response,
finalize_batch_response, parse_relay_json), the code uses text.find('{')
and text.rfind('}') to extract a JSON object from a messy response. When
the response body is binary garbage, those byte values can appear in any
order, causing start > end. The subsequent &text[start..=end] slice then
panics with 'begin > end' and a SIGILL core dump.
Add a bounds check at all three sites: if start > end, return a structured
BadResponse error instead of slicing. Reproducible whenever Apps Script
returns a non-JSON binary response body.1 parent c7472aa commit d3d41e9
1 file changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3037 | 3037 | | |
3038 | 3038 | | |
3039 | 3039 | | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
| 3044 | + | |
| 3045 | + | |
3040 | 3046 | | |
3041 | 3047 | | |
3042 | 3048 | | |
| |||
3205 | 3211 | | |
3206 | 3212 | | |
3207 | 3213 | | |
| 3214 | + | |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
| 3218 | + | |
| 3219 | + | |
3208 | 3220 | | |
3209 | 3221 | | |
3210 | 3222 | | |
| |||
4574 | 4586 | | |
4575 | 4587 | | |
4576 | 4588 | | |
| 4589 | + | |
| 4590 | + | |
| 4591 | + | |
| 4592 | + | |
| 4593 | + | |
| 4594 | + | |
4577 | 4595 | | |
4578 | 4596 | | |
4579 | 4597 | | |
| |||
0 commit comments