Compare commits

..

4 Commits

Author SHA1 Message Date
Ilya Leoshkevich
b0be612ef6
Merge 035f133798 into 538a82133a 2025-03-12 16:42:27 +08:00
Mike Pall
538a82133a Change handling of nil value markers in template tables.
Reported by Bernhard M. Wiedemann. #1348 #1155
Fixes from Peter Cawley, Christian Clason, Lewis Russell.
2025-03-11 23:04:30 +01:00
Mike Pall
84cb21ffaf REVERT: Change handling of nil value markers in template tables. 2025-03-10 02:56:07 +01:00
Mike Pall
4f2bb199fe macOS: Fix Apple hardened runtime support and put behind build option.
Reported by vanc. #1334
2025-03-10 02:53:20 +01:00
3 changed files with 7 additions and 5 deletions

View File

@ -191,7 +191,7 @@ static void bcread_ktabk(LexState *ls, TValue *o, GCtab *t)
} else if (tp == BCDUMP_KTAB_NUM) { } else if (tp == BCDUMP_KTAB_NUM) {
o->u32.lo = bcread_uleb128(ls); o->u32.lo = bcread_uleb128(ls);
o->u32.hi = bcread_uleb128(ls); o->u32.hi = bcread_uleb128(ls);
} else if (tp == BCDUMP_KTAB_NIL) { /* Restore nil value marker. */ } else if (t && tp == BCDUMP_KTAB_NIL) { /* Restore nil value marker. */
settabV(ls->L, o, t); settabV(ls->L, o, t);
} else { } else {
lj_assertLS(tp <= BCDUMP_KTAB_TRUE, "bad constant type %d", tp); lj_assertLS(tp <= BCDUMP_KTAB_TRUE, "bad constant type %d", tp);
@ -209,13 +209,13 @@ static GCtab *bcread_ktab(LexState *ls)
MSize i; MSize i;
TValue *o = tvref(t->array); TValue *o = tvref(t->array);
for (i = 0; i < narray; i++, o++) for (i = 0; i < narray; i++, o++)
bcread_ktabk(ls, o, t); bcread_ktabk(ls, o, NULL);
} }
if (nhash) { /* Read hash entries. */ if (nhash) { /* Read hash entries. */
MSize i; MSize i;
for (i = 0; i < nhash; i++) { for (i = 0; i < nhash; i++) {
TValue key; TValue key;
bcread_ktabk(ls, &key, t); bcread_ktabk(ls, &key, NULL);
lj_assertLS(!tvisnil(&key), "nil key"); lj_assertLS(!tvisnil(&key), "nil key");
bcread_ktabk(ls, lj_tab_set(ls->L, t, &key), t); bcread_ktabk(ls, lj_tab_set(ls->L, t, &key), t);
} }

View File

@ -263,7 +263,7 @@ static void *callback_mcode_init(global_State *g, uint32_t *page)
#endif #endif
/* Check for macOS hardened runtime. */ /* Check for macOS hardened runtime. */
#if LUAJIT_SECURITY_MCODE != 0 && defined(MAP_JIT) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110000 #if defined(LUAJIT_ENABLE_OSX_HRT) && LUAJIT_SECURITY_MCODE != 0 && defined(MAP_JIT) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110000
#include <pthread.h> #include <pthread.h>
#define CCMAP_CREATE MAP_JIT #define CCMAP_CREATE MAP_JIT
#else #else

View File

@ -99,7 +99,7 @@ static int mcode_setprot(void *p, size_t sz, DWORD prot)
#endif #endif
/* Check for macOS hardened runtime. */ /* Check for macOS hardened runtime. */
#if LUAJIT_SECURITY_MCODE != 0 && defined(MAP_JIT) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110000 #if defined(LUAJIT_ENABLE_OSX_HRT) && LUAJIT_SECURITY_MCODE != 0 && defined(MAP_JIT) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110000
#include <pthread.h> #include <pthread.h>
#define MCMAP_CREATE MAP_JIT #define MCMAP_CREATE MAP_JIT
#else #else
@ -111,6 +111,8 @@ static int mcode_setprot(void *p, size_t sz, DWORD prot)
#define MCPROT_RWX (PROT_READ|PROT_WRITE|PROT_EXEC) #define MCPROT_RWX (PROT_READ|PROT_WRITE|PROT_EXEC)
#ifdef PROT_MPROTECT #ifdef PROT_MPROTECT
#define MCPROT_CREATE (PROT_MPROTECT(MCPROT_RWX)) #define MCPROT_CREATE (PROT_MPROTECT(MCPROT_RWX))
#elif MCMAP_CREATE
#define MCPROT_CREATE PROT_EXEC
#else #else
#define MCPROT_CREATE 0 #define MCPROT_CREATE 0
#endif #endif