From 86d414f5cae062b06998ec66b0696a47d4f6a0f0 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Mon, 25 May 2026 01:25:32 +0200 Subject: Prevent sanitizer warning in os.time(). Reported by Sergey Bronnikov. #1454 --- src/lib_os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib_os.c b/src/lib_os.c index 1dd45e549..60b7b82d6 100644 --- a/src/lib_os.c +++ b/src/lib_os.c @@ -234,8 +234,8 @@ LJLIB_CF(os_time) ts.tm_min = getfield(L, "min", 0); ts.tm_hour = getfield(L, "hour", 12); ts.tm_mday = getfield(L, "day", -1); - ts.tm_mon = getfield(L, "month", -1) - 1; - ts.tm_year = getfield(L, "year", -1) - 1900; + ts.tm_mon = (int)((unsigned int)getfield(L, "month", -1) - 1u); + ts.tm_year = (int)((unsigned int)getfield(L, "year", -1) - 1900u); ts.tm_isdst = getboolfield(L, "isdst"); t = mktime(&ts); } -- cgit v1.2.3-55-g6feb From c3b379bf50c8819c61daa3afd9f21d9ec5708bd5 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Mon, 25 May 2026 01:26:26 +0200 Subject: FFI: Prevent sanitizer warning in carith_ptr(). Reported by Sergey Bronnikov. #1459 --- 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 e3287de9d..b1da0e2c3 100644 --- a/src/lj_carith.c +++ b/src/lj_carith.c @@ -133,7 +133,7 @@ static int carith_ptr(lua_State *L, CTState *cts, CDArith *ca, MMS mm) return 0; lj_cconv_ct_ct(cts, ctype_get(cts, CTID_INT_PSZ), ca->ct[1], (uint8_t *)&idx, ca->p[1], 0); - if (mm == MM_sub) idx = -idx; + if (mm == MM_sub) idx = (ptrdiff_t)(~(uintptr_t)idx+1u); } else if (mm == MM_add && ctype_isnum(ctp->info) && (ctype_isptr(ca->ct[1]->info) || ctype_isrefarray(ca->ct[1]->info))) { /* Swap pointer and index. */ -- cgit v1.2.3-55-g6feb