FFI: Always fall back to metamethods for cdata length/concat.

Thanks to Egor Skriptunoff.
This commit is contained in:
Mike Pall
2020-05-08 13:50:41 +02:00
parent 179cf2eb84
commit cc4bbec483
4 changed files with 6 additions and 14 deletions

View File

@@ -1443,8 +1443,10 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
}
{
TRef tr;
if (!(tr = crec_arith_int64(J, sp, s, (MMS)rd->data)) &&
!(tr = crec_arith_ptr(J, sp, s, (MMS)rd->data)) &&
MMS mm = (MMS)rd->data;
if ((mm == MM_len || mm == MM_concat ||
(!(tr = crec_arith_int64(J, sp, s, mm)) &&
!(tr = crec_arith_ptr(J, sp, s, mm)))) &&
!(tr = crec_arith_meta(J, sp, s, cts, rd)))
return;
J->base[0] = tr;