diff options
| author | Mike Pall <mike> | 2021-09-23 19:07:30 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2021-09-23 19:07:30 +0200 |
| commit | 94a40bb238092e73f3dc0c3626911a7efa997c22 (patch) | |
| tree | 91d6a12fe969962182aa525e0053afd42a31cec7 | |
| parent | 78350a2565e1cf1102bcd25be406f02953d4dd3b (diff) | |
| download | luajit-94a40bb238092e73f3dc0c3626911a7efa997c22.tar.gz luajit-94a40bb238092e73f3dc0c3626911a7efa997c22.tar.bz2 luajit-94a40bb238092e73f3dc0c3626911a7efa997c22.zip | |
FFI: Ensure returned string is alive in ffi.typeinfo().
Reported by zhuizhuhaomeng.
| -rw-r--r-- | src/lib_ffi.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lib_ffi.c b/src/lib_ffi.c index a29014e5..b4321048 100644 --- a/src/lib_ffi.c +++ b/src/lib_ffi.c | |||
| @@ -573,6 +573,7 @@ LJLIB_CF(ffi_typeinfo) | |||
| 573 | setintV(lj_tab_setstr(L, t, lj_str_newlit(L, "sib")), (int32_t)ct->sib); | 573 | setintV(lj_tab_setstr(L, t, lj_str_newlit(L, "sib")), (int32_t)ct->sib); |
| 574 | if (gcref(ct->name)) { | 574 | if (gcref(ct->name)) { |
| 575 | GCstr *s = gco2str(gcref(ct->name)); | 575 | GCstr *s = gco2str(gcref(ct->name)); |
| 576 | if (isdead(G(L), obj2gco(s))) flipwhite(obj2gco(s)); | ||
| 576 | setstrV(L, lj_tab_setstr(L, t, lj_str_newlit(L, "name")), s); | 577 | setstrV(L, lj_tab_setstr(L, t, lj_str_newlit(L, "name")), s); |
| 577 | } | 578 | } |
| 578 | lj_gc_check(L); | 579 | lj_gc_check(L); |
