Skip to content

Commit 73aad47

Browse files
author
Patrick Soquet
committed
XS: fix array flat/sort stack overflows
1 parent 46d6de4 commit 73aad47

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

xs/sources/xsArray.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,7 @@ void fxSortArrayItems(txMachine* the, txSlot* function, txSlot* array, txNumber
915915
while (index < LENGTH) {
916916
mxPushSlot(target);
917917
mxDeleteIndex(index);
918+
mxPop();
918919
index++;
919920
}
920921
mxPop();
@@ -1773,6 +1774,7 @@ txIndex fx_Array_prototype_flatAux(txMachine* the, txSlot* source, txIndex lengt
17731774
else {
17741775
mxPushSlot(mxResult);
17751776
mxDefineIndex(start, 0, XS_GET_ONLY);
1777+
mxPop();
17761778
start++;
17771779
}
17781780
}

xs/sources/xsmc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ void _xsDelete(txMachine *the, txSlot *self, txID id)
154154
mxOverflow(-1);
155155
fxPush(*self);
156156
mxDeleteID(id);
157+
mxPop();
157158
}
158159

159160
void _xsDeleteAt(txMachine *the, txSlot *self, txSlot *at)
@@ -162,6 +163,7 @@ void _xsDeleteAt(txMachine *the, txSlot *self, txSlot *at)
162163
fxPush(*self);
163164
fxPush(*at);
164165
fxDeleteAt(the);
166+
mxPop();
165167
}
166168

167169
void _xsCall(txMachine *the, txSlot *res, txSlot *self, txUnsigned id, ...)

0 commit comments

Comments
 (0)