From 47df3ae5136521da96767e6daed4cdd241de2fa6 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Fri, 20 Sep 2013 11:36:33 +0200 Subject: [PATCH] Properly fix loading of embedded bytecode. --- src/lj_bcread.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lj_bcread.c b/src/lj_bcread.c index 9f025500..940db9dd 100644 --- a/src/lj_bcread.c +++ b/src/lj_bcread.c @@ -446,7 +446,8 @@ GCproto *lj_bcread(LexState *ls) setprotoV(L, L->top, pt); incr_top(L); } - if (ls->p < ls->pe || L->top-1 != bcread_oldtop(L, ls)) + if ((int32_t)(2*(uint32_t)(ls->pe - ls->p)) > 0 || + L->top-1 != bcread_oldtop(L, ls)) bcread_error(ls, LJ_ERR_BCBAD); /* Pop off last prototype. */ L->top--;