Skip to content

Commit 8d4d2f2

Browse files
author
Patrick Soquet
committed
XS: fuzzilli 2 & 10
1 parent 14b06f3 commit 8d4d2f2

1 file changed

Lines changed: 33 additions & 20 deletions

File tree

xs/sources/xsLockdown.c

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,8 @@ static void fxVerifyCode(txMachine* the, txSlot* list, txSlot* path, txByte* cod
414414
static void fxVerifyError(txMachine* the, txSlot* path, txID id, txIndex index, txString name);
415415
static void fxVerifyErrorString(txMachine* the, txSlot* slot, txID id, txIndex index, txString name);
416416
static void fxVerifyInstance(txMachine* the, txSlot* list, txSlot* path, txSlot* instance);
417-
static void fxVerifyProperty(txMachine* the, txSlot *list, txSlot *path, txSlot* property, txID id, txIndex index, txSlot* array);
417+
static void fxVerifyProperty(txMachine* the, txSlot *list, txSlot *path, txSlot* property, txID id);
418+
static void fxVerifyPropertyError(txMachine* the, txSlot *list, txSlot *path, txSlot* property, txID id, txIndex index);
418419
static void fxVerifyQueue(txMachine* the, txSlot* list, txSlot* path, txSlot* instance, txID id, txIndex index, txString name);
419420

420421
void fx_mutabilities(txMachine* the)
@@ -697,10 +698,21 @@ void fxVerifyInstance(txMachine* the, txSlot* list, txSlot* path, txSlot* instan
697698
{
698699
txSlot* address = property->value.array.address;
699700
if (address) {
700-
txIndex offset = 0, size = (((txChunk*)(((txByte*)address) - sizeof(txChunk)))->size) / sizeof(txSlot);
701+
txIndex index, offset = 0, size = (((txChunk*)(((txByte*)address) - sizeof(txChunk)))->size) / sizeof(txSlot);
701702
while (offset < size) {
702703
address = property->value.array.address + offset;
703-
fxVerifyProperty(the, list, path, address, XS_NO_ID, *((txIndex*)address), property);
704+
index = *((txIndex*)address);
705+
fxVerifyPropertyError(the, list, path, address, XS_NO_ID, index);
706+
address = property->value.array.address + offset;
707+
if (address->kind == XS_REFERENCE_KIND)
708+
fxVerifyQueue(the, list, path, address->value.reference, XS_NO_ID, index, C_NULL);
709+
else if (address->kind == XS_ACCESSOR_KIND) {
710+
if (address->value.accessor.getter)
711+
fxVerifyQueue(the, list, path, address->value.accessor.getter, XS_NO_ID, index, C_NULL);
712+
address = property->value.array.address + offset;
713+
if (address->value.accessor.setter)
714+
fxVerifyQueue(the, list, path, address->value.accessor.setter, XS_NO_ID, index, C_NULL);
715+
}
704716
offset++;
705717
}
706718
}
@@ -741,7 +753,7 @@ void fxVerifyInstance(txMachine* the, txSlot* list, txSlot* path, txSlot* instan
741753
if (property->value.export.closure) {
742754
txSlot* closure = property->value.export.closure;
743755
closure->flag |= XS_DONT_DELETE_FLAG;
744-
fxVerifyProperty(the, list, path, closure, property->ID, 0, C_NULL);
756+
fxVerifyProperty(the, list, path, closure, property->ID);
745757
closure->flag &= ~XS_DONT_DELETE_FLAG;
746758
}
747759
property = property->next;
@@ -753,7 +765,7 @@ void fxVerifyInstance(txMachine* the, txSlot* list, txSlot* path, txSlot* instan
753765
{
754766
txSlot* item = property->value.private.first;
755767
while (item) {
756-
fxVerifyProperty(the, list, path, item, item->ID, 0, C_NULL);
768+
fxVerifyProperty(the, list, path, item, item->ID);
757769
item = item->next;
758770
}
759771
}
@@ -781,34 +793,35 @@ void fxVerifyInstance(txMachine* the, txSlot* list, txSlot* path, txSlot* instan
781793
}
782794
}
783795
else {
784-
fxVerifyProperty(the, list, path, property, property->ID, 0, C_NULL);
796+
fxVerifyProperty(the, list, path, property, property->ID);
785797
}
786798
property = property->next;
787799
}
788800
}
789801

790-
void fxVerifyProperty(txMachine* the, txSlot *list, txSlot *path, txSlot* property, txID id, txIndex index, txSlot* array)
802+
void fxVerifyProperty(txMachine* the, txSlot *list, txSlot *path, txSlot* property, txID id)
791803
{
792-
txBoolean immutable = 1;
804+
fxVerifyPropertyError(the, list, path, property, id, 0);
805+
if (property->kind == XS_REFERENCE_KIND)
806+
fxVerifyQueue(the, list, path, property->value.reference, id, 0, C_NULL);
807+
else if (property->kind == XS_ACCESSOR_KIND) {
808+
if (property->value.accessor.getter)
809+
fxVerifyQueue(the, list, path, property->value.accessor.getter, id, 0, C_NULL);
810+
if (property->value.accessor.setter)
811+
fxVerifyQueue(the, list, path, property->value.accessor.setter, id, 0, C_NULL);
812+
}
813+
}
793814

815+
void fxVerifyPropertyError(txMachine* the, txSlot *list, txSlot *path, txSlot* property, txID id, txIndex index)
816+
{
817+
txBoolean immutable = 1;
794818
if (property->kind != XS_ACCESSOR_KIND)
795819
if (!(property->flag & XS_DONT_SET_FLAG))
796820
immutable = 0;
797821
if (!(property->flag & XS_DONT_DELETE_FLAG))
798822
immutable = 0;
799-
if (!immutable) {
823+
if (!immutable)
800824
fxVerifyError(the, path, id, index, C_NULL);
801-
if (array)
802-
property = array->value.array.address + index;
803-
}
804-
if (property->kind == XS_REFERENCE_KIND)
805-
fxVerifyQueue(the, list, path, property->value.reference, id, index, C_NULL);
806-
else if (property->kind == XS_ACCESSOR_KIND) {
807-
if (property->value.accessor.getter)
808-
fxVerifyQueue(the, list, path, property->value.accessor.getter, id, index, C_NULL);
809-
if (property->value.accessor.setter)
810-
fxVerifyQueue(the, list, path, property->value.accessor.setter, id, index, C_NULL);
811-
}
812825
}
813826

814827
void fxVerifyQueue(txMachine* the, txSlot* list, txSlot* path, txSlot* instance, txID id, txIndex index, txString string)

0 commit comments

Comments
 (0)