diff options
-rw-r--r-- | src/lj_carith.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lj_carith.c b/src/lj_carith.c index 96384e87..bad5fe66 100644 --- a/src/lj_carith.c +++ b/src/lj_carith.c | |||
@@ -42,9 +42,13 @@ static int carith_checkarg(lua_State *L, CTState *cts, CDArith *ca) | |||
42 | p = (uint8_t *)cdata_getptr(p, ct->size); | 42 | p = (uint8_t *)cdata_getptr(p, ct->size); |
43 | if (ctype_isref(ct->info)) ct = ctype_rawchild(cts, ct); | 43 | if (ctype_isref(ct->info)) ct = ctype_rawchild(cts, ct); |
44 | } else if (ctype_isfunc(ct->info)) { | 44 | } else if (ctype_isfunc(ct->info)) { |
45 | CTypeID id0 = i ? ctype_typeid(cts, ca->ct[0]) : 0; | ||
45 | p = (uint8_t *)*(void **)p; | 46 | p = (uint8_t *)*(void **)p; |
46 | ct = ctype_get(cts, | 47 | ct = ctype_get(cts, |
47 | lj_ctype_intern(cts, CTINFO(CT_PTR, CTALIGN_PTR|id), CTSIZE_PTR)); | 48 | lj_ctype_intern(cts, CTINFO(CT_PTR, CTALIGN_PTR|id), CTSIZE_PTR)); |
49 | if (i) { /* cts->tab may have been reallocated. */ | ||
50 | ca->ct[0] = ctype_get(cts, id0); | ||
51 | } | ||
48 | } | 52 | } |
49 | if (ctype_isenum(ct->info)) ct = ctype_child(cts, ct); | 53 | if (ctype_isenum(ct->info)) ct = ctype_child(cts, ct); |
50 | ca->ct[i] = ct; | 54 | ca->ct[i] = ct; |