Skip to content

Commit

Permalink
Merge pull request #80 from Sei-Lisa/sei-fix-parser-segfault
Browse files Browse the repository at this point in the history
Fix segfault when recovering from syntax error after the last global
  • Loading branch information
Makopo authored Apr 22, 2018
2 parents 27ee114 + b5d9e85 commit 7a59cb0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lslmini.y
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,14 @@ globals
}
| global globals
{
if ( $1 ) {
if ( $1 && $2 ) {
DEBUG( LOG_DEBUG_SPAM, NULL, "** global [%p,%p] globals [%p,%p]\n", $1->get_prev(), $1->get_next(), $2->get_prev(), $2->get_next());
$1->add_next_sibling($2);
$$ = $1;
} else {
$$ = $2;
$$ = $2 ? $2 : $1;
}
}
| error ';'
{
$$ = NULL;
}
;

global
Expand All @@ -265,6 +261,10 @@ global
{
$$ = new LLScriptGlobalStorage(NULL, $1);
}
| error ';'
{
$$ = NULL;
}
;

name_type
Expand Down
3 changes: 3 additions & 0 deletions scripts/bugs/0079a.lsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
integer a; // $[E20009] Declared but not used
b; // $[E10019] Syntax error (it was causing a segfault)
default { state_entry() {} }
4 changes: 4 additions & 0 deletions scripts/bugs/0079b.lsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
integer a; // $[E20009] Declared and not used
b; // $[E10019] Syntax error
integer c; // $[E20009] Declared and not used
default { state_entry() {} }

0 comments on commit 7a59cb0

Please sign in to comment.