1
0
mirror of synced 2024-11-28 09:30:51 +01:00

pattern: Fixed use-after-free when accessing arrays through an r-value

This commit is contained in:
WerWolv 2022-02-06 18:04:33 +01:00
parent 99f8efac9a
commit 334939324c

View File

@ -1556,7 +1556,14 @@ namespace hex::pl {
explicit ASTNodeRValue(Path path) : ASTNode(), m_path(std::move(path)) { }
ASTNodeRValue(const ASTNodeRValue &) = default;
ASTNodeRValue(const ASTNodeRValue &other) {
for (auto &part : other.m_path) {
if (auto stringPart = std::get_if<std::string>(&part); stringPart != nullptr)
this->m_path.push_back(*stringPart);
else if (auto nodePart = std::get_if<ASTNode *>(&part); nodePart != nullptr)
this->m_path.push_back((*nodePart)->clone());
}
}
~ASTNodeRValue() override {
for (auto &part : this->m_path) {