Commit 3bdf97f
Fix index-out-of-range panic in wrapError at EOF
`wrapError` walks `p.lexer.input[i]` for `i < int(p.Pos())` to compute the
error line/column. At EOF `p.Pos()` can exceed `len(input)`, so on input like
`CREATE--` (a trailing comment leaves the position past the end) it panics
with "index out of range".
Clamp the loop bound to `len(p.lexer.input)`.
Add `CREATE--` to TestParser_InvalidSyntax to reproduce: it panicked before
the fix and now returns a proper error.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 88f462c commit 3bdf97f
2 files changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
377 | | - | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
378 | 384 | | |
379 | 385 | | |
380 | 386 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
| 190 | + | |
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
| |||
0 commit comments