Critical: tokenEnd returns len(data) vs stringEnd/blockEnd returning -1. The inconsistency means getType silently accepts truncated tokens. Verifies: SYS-REQ-001 [boundary]
(t *testing.T)
| 181 | // The inconsistency means getType silently accepts truncated tokens. |
| 182 | // Verifies: SYS-REQ-001 [boundary] |
| 183 | func TestRemoval2_Inconsistency_TruncatedNumber(t *testing.T) { |
| 184 | // Consider: `{"a": 12` — the number "12" has no terminator. |
| 185 | // tokenEnd("12") returns 2, so getType will return "12" as a Number. |
| 186 | // This is actually CORRECT behavior for a streaming parser, |
| 187 | // but it means we can't distinguish "complete number" from "truncated input". |
| 188 | // The removed guard would NOT have caught this either (tokenEnd never returns -1). |
| 189 | val, dt, _, err := Get([]byte(`{"a": 12`), "a") |
| 190 | if err != nil { |
| 191 | t.Logf("Error on truncated number: %v (this is fine)", err) |
| 192 | } else { |
| 193 | t.Logf("Truncated number parsed as: val=%q type=%v", val, dt) |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | // ============================================================================= |
| 198 | // REMOVAL 3: `r <= basicMultilingualPlaneOffset` removed in decodeUnicodeEscape |