From f2a1cd43281361035149b6eedbd267b5e71d64d0 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Wed, 3 Jul 2024 23:43:57 +0200 Subject: [PATCH] FFI: Fix __tostring metamethod access to enum cdata value. Thanks to Sergey Kaplun. #1232 --- src/lib_ffi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib_ffi.c b/src/lib_ffi.c index cf9cf9f5..1422dea6 100644 --- a/src/lib_ffi.c +++ b/src/lib_ffi.c @@ -304,7 +304,7 @@ LJLIB_CF(ffi_meta___tostring) p = *(void **)p; } else if (ctype_isenum(ct->info)) { msg = "cdata<%s>: %d"; - p = (void *)(uintptr_t)*(uint32_t **)p; + p = (void *)(uintptr_t)*(uint32_t *)p; } else { if (ctype_isptr(ct->info)) { p = cdata_getptr(p, ct->size);