Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3c3b27

Browse files
committed
Fix a bug in stack overflow error handling. This fixes half of Bug
#115555. The error from s_push() on stack overflow was -1, which was passed through unchanged by push(), but not tested for by push()'s caller -- which only expected positive error codes. Fixed by changing s_push() to return E_NOMEM on stack overflow. (Not quite the proper error code either, but I can't be bothered adding a new E_STACKOVERFLOW error code in all the right places.)
1 parent f6791f3 commit e3c3b27

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Parser/parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ s_push(register stack *s, dfa *d, node *parent)
4040
register stackentry *top;
4141
if (s->s_top == s->s_base) {
4242
fprintf(stderr, "s_push: parser stack overflow\n");
43-
return -1;
43+
return E_NOMEM;
4444
}
4545
top = --s->s_top;
4646
top->s_dfa = d;

0 commit comments

Comments
 (0)