]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
FFI: Fix __tostring metamethod access to enum cdata value.
authorMike Pall <mike>
Wed, 3 Jul 2024 21:43:57 +0000 (23:43 +0200)
committerMike Pall <mike>
Wed, 3 Jul 2024 21:43:57 +0000 (23:43 +0200)
Thanks to Sergey Kaplun. #1232

src/lib_ffi.c

index cf9cf9f5f16db8df10ff603545642642d820cfcc..1422dea67687b4492bccf4e1ef4a1253e154f256 100644 (file)
@@ -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);