Skip to content

Commit

Permalink
lj_ctype.c: Detect loops in ctype_repr()
Browse files Browse the repository at this point in the history
  • Loading branch information
lukego committed Aug 9, 2018
1 parent 9fac632 commit 3f9db9e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lj_ctype.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ static void ctype_repr(CTRepr *ctr, CTypeID id)
for (;;) {
CTInfo info = ct->info;
CTSize size = ct->size;
CType *newct;
switch (ctype_type(info)) {
case CT_NUM:
if ((info & CTF_BOOL)) {
Expand Down Expand Up @@ -532,7 +533,13 @@ static void ctype_repr(CTRepr *ctr, CTypeID id)
ctr->ok = 0;
return;
}
ct = ctype_get(ctr->cts, ctype_cid(info));
newct = ctype_get(ctr->cts, ctype_cid(info));
/* Detect ctypes that are not OK due to looping. */
if (newct == ct) {
ctr->ok = 0;
return;
}
ct = newct;
}
}

Expand Down

0 comments on commit 3f9db9e

Please sign in to comment.