[llvm] [llvm][mustache] Fix UB in ASTNode::render() (PR #142249)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 3 12:31:02 PDT 2025
================
@@ -560,68 +566,71 @@ void toMustacheString(const json::Value &Data, raw_ostream &OS) {
}
}
-void ASTNode::render(const json::Value &Data, raw_ostream &OS) {
- ParentContext = &Data;
+void ASTNode::render(const json::Value &CurrentCtx, raw_ostream &OS) {
+ // Set the parent context to the incoming context so that we
+ // can walk up the context tree correctly in findContext().
+ ParentContext = &CurrentCtx;
----------------
nikic wrote:
Not related to your change, but seeing this, I wonder why we don't also have to reset ParentContext to the original value when leaving the recursion?
https://github.com/llvm/llvm-project/pull/142249
More information about the llvm-commits
mailing list