GH-170: fix segfault triggered by invalid pattern symbols

Fixes GH-170
This commit is contained in:
Jon Siwek 2019-01-15 14:24:55 -06:00
parent 6eee5ded61
commit 39b1d49fc3
3 changed files with 17 additions and 2 deletions

View file

@ -1,4 +1,8 @@
2.6-77 | 2019-01-15 14:24:55 -0600
* GH-170: fix segfault triggered by invalid pattern symbols (Jon Siwek, Corelight)
2.6-76 | 2019-01-15 12:12:09 -0600 2.6-76 | 2019-01-15 12:12:09 -0600
* GH-172: fix broxygen not merging bif and script identifier comments (Jon Siwek, Corelight) * GH-172: fix broxygen not merging bif and script identifier comments (Jon Siwek, Corelight)

View file

@ -1 +1 @@
2.6-76 2.6-77

View file

@ -131,7 +131,18 @@ singleton : singleton '*'
{ $$ = $2; case_insensitive = 0; } { $$ = $2; case_insensitive = 0; }
| TOK_CHAR | TOK_CHAR
{ $$ = new NFA_Machine(new NFA_State($1, rem->EC())); } {
auto sym = $1;
if ( sym < 0 || ( sym >= NUM_SYM && sym != SYM_EPSILON ) )
{
reporter->Error("bad symbol %d (compiling pattern /%s/)", sym,
RE_parse_input);
return 1;
}
$$ = new NFA_Machine(new NFA_State(sym, rem->EC()));
}
| '^' | '^'
{ {