浏览代码

FFI: Ensure returned string is alive in ffi.typeinfo().

Reported by zhuizhuhaomeng.
Mike Pall 4 年之前
父节点
当前提交
94a40bb238
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      src/lib_ffi.c

+ 1 - 0
src/lib_ffi.c

@@ -573,6 +573,7 @@ LJLIB_CF(ffi_typeinfo)
       setintV(lj_tab_setstr(L, t, lj_str_newlit(L, "sib")), (int32_t)ct->sib);
     if (gcref(ct->name)) {
       GCstr *s = gco2str(gcref(ct->name));
+      if (isdead(G(L), obj2gco(s))) flipwhite(obj2gco(s));
       setstrV(L, lj_tab_setstr(L, t, lj_str_newlit(L, "name")), s);
     }
     lj_gc_check(L);