summaryrefslogtreecommitdiff
path: root/src/expr/node_manager.cpp
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2020-07-17 15:25:54 -0700
committerGitHub <noreply@github.com>2020-07-17 15:25:54 -0700
commit8f085eb6a087242ab8c775ec4fe41ab9a194cec2 (patch)
treeb21935259add8fdbfca57bf4fdd1a76ea96985d9 /src/expr/node_manager.cpp
parentf99889b0c1260fccf28daac995e58312912bae9f (diff)
Add NodeManagerScopes to fix use-after-free issues (#4768)
This commit fixes our current ASan issues. Some methods in `NodeManager` were not creating a `NodeManagerScope` for `this` but were indirectly calling methods that get the `NodeManager` from the current scope, so we ended up calling methods on a `NodeManager` that had already been destroyed.
Diffstat (limited to 'src/expr/node_manager.cpp')
-rw-r--r--src/expr/node_manager.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/expr/node_manager.cpp b/src/expr/node_manager.cpp
index c68b0df86..e9f56bf3f 100644
--- a/src/expr/node_manager.cpp
+++ b/src/expr/node_manager.cpp
@@ -106,6 +106,10 @@ NodeManager::NodeManager(ExprManager* exprManager)
}
void NodeManager::init() {
+ // `mkConst()` indirectly needs the correct NodeManager in scope because we
+ // call `NodeValue::inc()` which uses `NodeManager::curentNM()`
+ NodeManagerScope nms(this);
+
poolInsert( &expr::NodeValue::null() );
for(unsigned i = 0; i < unsigned(kind::LAST_KIND); ++i) {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback