From 247ead6718767d4b83ca5e94ebb4b31331630551 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Mon, 8 Sep 2014 23:28:02 +0200 Subject: [PATCH 1/2] FFI: Fix for cdata vs. non-cdata arithmetic and comparisons. Thanks to Roman Tsisyk. --- src/lj_crecord.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lj_crecord.c b/src/lj_crecord.c index 2b83f3a1..fe08b935 100644 --- a/src/lj_crecord.c +++ b/src/lj_crecord.c @@ -1434,6 +1434,7 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd) } } else if (!tref_isnum(tr)) { tr = 0; + ct = ctype_get(cts, CTID_P_VOID); } ok: s[i] = ct; From 41156fe1cdd6b60a5e8d9855c57699e89ccfbf97 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Mon, 8 Sep 2014 23:37:22 +0200 Subject: [PATCH 2/2] FFI: Fix initialization of unions of subtypes. Thanks to Peter Colberg. --- src/lj_cconv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lj_cconv.c b/src/lj_cconv.c index de4938e4..90cd36e3 100644 --- a/src/lj_cconv.c +++ b/src/lj_cconv.c @@ -702,6 +702,7 @@ static void cconv_substruct_init(CTState *cts, CType *d, uint8_t *dp, } else if (ctype_isxattrib(df->info, CTA_SUBTYPE)) { cconv_substruct_init(cts, ctype_rawchild(cts, df), dp+df->size, o, len, ip); + if ((d->info & CTF_UNION)) break; } /* Ignore all other entries in the chain. */ } }