84317d3d2a186450f811b2ea8b48918a1b63ade5
- Author
- outfoxxed <outfoxxed@outfoxxed.me>
- Committer
- outfoxxed <outfoxxed@outfoxxed.me>
- Date
Message
Fix UAF when collapsing children of ephemeral nodes in a shift
Diff
1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
2index 59c85df68d795466bfa212220a17d2a068427b26..0e14fd3d253c85453c3f18cc5dca55650c23a0d5 100644
3--- a/src/Hy3Layout.cpp
4+++ b/src/Hy3Layout.cpp
5@@ -1426,7 +1426,9 @@ Hy3Node* Hy3Layout::shiftOrGetFocus(
6
7 if (old_parent != nullptr) {
8 auto& group = old_parent->data.as_group;
9- if (old_parent->parent != nullptr && group.ephemeral && group.children.size() == 1) {
10+ if (old_parent->parent != nullptr && group.ephemeral && group.children.size() == 1
11+ && !group.hasChild(&node))
12+ {
13 Hy3Node::swallowGroups(old_parent);
14 }
15