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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user