From b58b07189521e82c7a8e8bc43fc3c271f89832fd Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Fri, 27 Mar 2026 19:47:27 +0100 Subject: FFI: Fix pointer difference operation on 64 bit platforms. Thanks to cuiweixie. #1449 --- src/lj_carith.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lj_carith.c b/src/lj_carith.c index 418400cf..e3287de9 100644 --- a/src/lj_carith.c +++ b/src/lj_carith.c @@ -118,7 +118,7 @@ static int carith_ptr(lua_State *L, CTState *cts, CDArith *ca, MMS mm) /* All valid pointer differences on x64 are in (-2^47, +2^47), ** which fits into a double without loss of precision. */ - setintptrV(L->top-1, (int32_t)diff); + setintptrV(L->top-1, diff); return 1; } else if (mm == MM_lt) { /* Pointer comparison (unsigned). */ setboolV(L->top-1, ((uintptr_t)pp < (uintptr_t)pp2)); -- cgit v1.2.3-55-g6feb From f322ecb51e3cea06683cc201e8ce224ec42fdab8 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Fri, 27 Mar 2026 19:49:05 +0100 Subject: Prevent false positive sanitizer warning in unpack(). Reported by Sergey Bronnikov. #1450 --- src/lib_base.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib_base.c b/src/lib_base.c index 0f402400..046518c7 100644 --- a/src/lib_base.c +++ b/src/lib_base.c @@ -236,7 +236,9 @@ LJLIB_CF(unpack) } else { setnilV(L->top++); } - } while (i++ < e); + if (i >= e) break; + i++; + } while (1); return n; } -- cgit v1.2.3-55-g6feb