Skip to content

Commit

Permalink
21636: Fixes possible crash when zipping an empty list (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
howsohazard authored Sep 23, 2024
1 parent 4f1912c commit 10a89ca
Show file tree
Hide file tree
Showing 2 changed files with 4,106 additions and 4,082 deletions.
21 changes: 10 additions & 11 deletions src/Amalgam/interpreter/InterpreterOpcodesTransformations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1669,18 +1669,17 @@ EvaluableNodeReference Interpreter::InterpretNode_ENT_ZIP(EvaluableNode *en, boo

//get value
EvaluableNode *value = nullptr;
if(value_list != nullptr)
if(EvaluableNode::IsOrderedArray(value_list))
{
if(value_list->IsOrderedArray() && i < value_list->GetOrderedChildNodes().size())
{
value = value_list->GetOrderedChildNodes()[i];
}
else //not a list, so just use the value itself
{
value = value_list;
//reusing the value, so can't be cycle free in the result
result->SetNeedCycleCheck(true);
}
auto &vl_ocn = value_list->GetOrderedChildNodesReference();
if(i < vl_ocn.size())
value = vl_ocn[i];
}
else //not a list, so just use the value itself
{
value = value_list;
//reusing the value, so can't be cycle free in the result
result->SetNeedCycleCheck(true);
}

//if no function, then just put value into the appropriate slot for the index
Expand Down
Loading

0 comments on commit 10a89ca

Please sign in to comment.