Fix UAF when collapsing children of ephemeral nodes in a shift

This commit is contained in:
outfoxxed 2023-07-29 03:08:35 -07:00
parent 3fbaa4adf5
commit 84317d3d2a
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E

View file

@ -1426,7 +1426,9 @@ Hy3Node* Hy3Layout::shiftOrGetFocus(
if (old_parent != nullptr) {
auto& group = old_parent->data.as_group;
if (old_parent->parent != nullptr && group.ephemeral && group.children.size() == 1) {
if (old_parent->parent != nullptr && group.ephemeral && group.children.size() == 1
&& !group.hasChild(&node))
{
Hy3Node::swallowGroups(old_parent);
}