aboutsummaryrefslogtreecommitdiff
path: root/src/lj_bcread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_bcread.c')
-rw-r--r--src/lj_bcread.c3
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--;