Skip to content

Commit

Permalink
GC: fix ptr->vt < P->vts->len check for user objects
Browse files Browse the repository at this point in the history
len < 100 but ptr->vt starts at PN_TNIL.
It caused example/binarytrees.pn errors
  • Loading branch information
Reini Urban committed Sep 9, 2014
1 parent 74c0051 commit bcb24a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ PN_SIZE potion_type_size(Potion *P, const struct PNObject *ptr) {

if (ptr->vt < PN_TNIL) goto err;
if (ptr->vt > PN_TUSER) {
if (P->vts && ptr->vt < P->vts->len
if (P->vts && ptr->vt < PN_TNIL + P->vts->len
&& PN_VTABLE(ptr->vt) && PN_TYPECHECK(ptr->vt)) {
sz = sizeof(struct PNObject) +
(((struct PNVtable *)PN_VTABLE(ptr->vt))->ivlen * sizeof(PN));
Expand Down

0 comments on commit bcb24a3

Please sign in to comment.