Skip to content

Commit

Permalink
FFI: Fix pragma push stack limit check and throw on overflow.
Browse files Browse the repository at this point in the history
Reported by Sergey Kaplun. LuaJIT#1114
  • Loading branch information
Mike Pall committed Nov 7, 2023
1 parent d133d67 commit 433d7e8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lj_cparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1747,9 +1747,11 @@ static void cp_pragma(CPState *cp, BCLine pragmaline)
cp_check(cp, '(');
if (cp->tok == CTOK_IDENT) {
if (cp->str->hash == H_(738e923c,a1b65954)) { /* push */
if (cp->curpack < CPARSE_MAX_PACKSTACK) {
if (cp->curpack < CPARSE_MAX_PACKSTACK-1) {
cp->packstack[cp->curpack+1] = cp->packstack[cp->curpack];
cp->curpack++;
} else {
cp_errmsg(cp, cp->tok, LJ_ERR_XLEVELS);
}
} else if (cp->str->hash == H_(6c71cf27,6c71cf27)) { /* pop */
if (cp->curpack > 0) cp->curpack--;
Expand Down

0 comments on commit 433d7e8

Please sign in to comment.