diff options
author | Mike Pall <mike> | 2020-01-13 14:28:43 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2020-01-13 14:28:43 +0100 |
commit | 820339960123dc78a7ce03edf53fcf4fdae0e55d (patch) | |
tree | 5be584eb5d8cf65ce8d48a0e43d97f3f2b72d873 /src/lj_bcread.c | |
parent | 45a7e5073ce0a59465fef0b80bb08bd4e76b7979 (diff) | |
download | luajit-820339960123dc78a7ce03edf53fcf4fdae0e55d.tar.gz luajit-820339960123dc78a7ce03edf53fcf4fdae0e55d.tar.bz2 luajit-820339960123dc78a7ce03edf53fcf4fdae0e55d.zip |
Fix embedded bytecode loader.
Diffstat (limited to 'src/lj_bcread.c')
-rw-r--r-- | src/lj_bcread.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lj_bcread.c b/src/lj_bcread.c index 6a462bd6..62695ef4 100644 --- a/src/lj_bcread.c +++ b/src/lj_bcread.c | |||
@@ -80,6 +80,7 @@ static LJ_NOINLINE void bcread_fill(LexState *ls, MSize len, int need) | |||
80 | ls->current = -1; /* Only bad if we get called again. */ | 80 | ls->current = -1; /* Only bad if we get called again. */ |
81 | break; | 81 | break; |
82 | } | 82 | } |
83 | if (size >= LJ_MAX_MEM - ls->sb.n) lj_err_mem(ls->L); | ||
83 | if (ls->sb.n) { /* Append to buffer. */ | 84 | if (ls->sb.n) { /* Append to buffer. */ |
84 | MSize n = ls->sb.n + (MSize)size; | 85 | MSize n = ls->sb.n + (MSize)size; |
85 | bcread_resize(ls, n < len ? len : n); | 86 | bcread_resize(ls, n < len ? len : n); |
@@ -467,7 +468,7 @@ GCproto *lj_bcread(LexState *ls) | |||
467 | setprotoV(L, L->top, pt); | 468 | setprotoV(L, L->top, pt); |
468 | incr_top(L); | 469 | incr_top(L); |
469 | } | 470 | } |
470 | if ((int32_t)ls->n > 0 || L->top-1 != bcread_oldtop(L, ls)) | 471 | if ((ls->n && !ls->endmark) || L->top-1 != bcread_oldtop(L, ls)) |
471 | bcread_error(ls, LJ_ERR_BCBAD); | 472 | bcread_error(ls, LJ_ERR_BCBAD); |
472 | /* Pop off last prototype. */ | 473 | /* Pop off last prototype. */ |
473 | L->top--; | 474 | L->top--; |