Skip to content

Commit

Permalink
parser.act: Avoid crash in parser from '(*:'.
Browse files Browse the repository at this point in the history
See #386 on katef/libfsm.

This is a workaround for a bug in the parser -- once the fuzzer
finds it, it tends to get in the way of finding deeper issues.
  • Loading branch information
silentbicycle committed Apr 24, 2023
1 parent fa960bc commit 692ce7b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/libre/parser.act
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,17 @@
err->e = RE_ESUCCESS;

ADVANCE_LEXER;

#define BUILD_FOR_FUZZER 0
#if BUILD_FOR_FUZZER
/* these errors currently are not handled properly */
if (act_state->lex_tok == TOK_ERROR) {
fprintf(stderr, "syntax error\n");
lx->free(lx->buf_opaque);
goto error;
}
#endif

DIALECT_ENTRY(&flags, lex_state, act_state, err, &ast->expr);

lx->free(lx->buf_opaque);
Expand Down

0 comments on commit 692ce7b

Please sign in to comment.