Commit 01c2d77
fix(#429): prevent SIGSEGV in buildPublishedRestResourceDef on malformed REST syntax
ANTLR error-recovery leaves STRING_LITERAL() nil when the publishedRestResource
rule cannot match (e.g. `end resource` keyword-style or missing opening brace).
The bare GetText() call on the nil token caused a SIGSEGV.
Add a nil guard at the top of buildPublishedRestResourceDef so it returns nil
instead of crashing. Guard both call sites (CREATE path and ALTER ADD RESOURCE
path) to skip nil results rather than appending them.
Regression test added: Build() on the exact crash input must not panic.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent b3b41c5 commit 01c2d77
2 files changed
Lines changed: 22 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
376 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
377 | 379 | | |
378 | 380 | | |
379 | 381 | | |
380 | 382 | | |
381 | 383 | | |
382 | 384 | | |
383 | 385 | | |
| 386 | + | |
384 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
385 | 391 | | |
386 | 392 | | |
387 | 393 | | |
| |||
472 | 478 | | |
473 | 479 | | |
474 | 480 | | |
475 | | - | |
476 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
477 | 484 | | |
478 | 485 | | |
479 | 486 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
0 commit comments