Skip to content
Snippets Groups Projects
Commit edd88177 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström Committed by Marcus Comstedt
Browse files

CritBit: Fixed stack inconsistency issues in _m_delete().

cb_delete() did not always set the output value.

_m_delete() now survives a gc() being triggered during cb_delete().
parent c1a61988
No related branches found
No related tags found
No related merge requests found
...@@ -326,6 +326,8 @@ PARENT: ...@@ -326,6 +326,8 @@ PARENT:
} }
} }
} else if (val) {
SET_SVAL(*val, PIKE_T_INT, NUMBER_UNDEFINED, integer, 0);
} }
cb_check_node(tree->root); cb_check_node(tree->root);
......
...@@ -77,7 +77,12 @@ cmod_DEFINE_EVAL(COPY_NODE, TREE_CLASSIFY(_copy_node)) ...@@ -77,7 +77,12 @@ cmod_DEFINE_EVAL(COPY_NODE, TREE_CLASSIFY(_copy_node))
oldsize = (THIS->tree.root) ? THIS->tree.root->size : 0; oldsize = (THIS->tree.root) ? THIS->tree.root->size : 0;
if (oldsize) { if (oldsize) {
cb_delete(& THIS->tree, k, Pike_sp++); /* NB: cb_delete() may run pike code (like eg when
* comparing bignums). The stack must thus be
* consistent in case eg a gc() is triggered.
*/
push_undefined();
cb_delete(& THIS->tree, k, Pike_sp-1);
size = (THIS->tree.root) ? THIS->tree.root->size : 0; size = (THIS->tree.root) ? THIS->tree.root->size : 0;
if (size < oldsize) { if (size < oldsize) {
THIS->rev++; THIS->rev++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment