1
0
mirror of https://github.com/janet-lang/janet synced 2026-04-18 04:41:28 +00:00

Add configurable stack overflow to prevent infinite recursion

without waiting for out of memory.
This commit is contained in:
Calvin Rose
2018-02-12 11:49:10 -05:00
parent 7f693796ea
commit af6e6ded35
5 changed files with 16 additions and 3 deletions

View File

@@ -458,12 +458,12 @@ static int root(DstParser *p, DstParseState *state, uint8_t c) {
int dst_parser_consume(DstParser *parser, uint8_t c) {
int consumed = 0;
if (parser->error) return 0;
parser->index++;
while (!consumed && !parser->error) {
DstParseState *state = &dst_v_last(parser->states);
consumed = state->consumer(parser, state, c);
}
parser->lookback = c;
parser->index++;
return 1;
}