chat-peg-parser : clear current_tool when pending_tool_call is reset (#29942)

A TOOL_ID node that arrives after TOOL_CLOSE wrote through `current_tool`,
which still pointed into the just-destroyed `pending_tool_call` optional
(use-after-free, then a second free of the id buffer). Clear the pointer on
reset.
This commit is contained in:
Anas authored and GitHub committed 2026-10-04 17:59:21 +02:00
1 parent 46847e6158
commit dbe4c3ed42
1 file changed
+1
+1
View File
@@ -451,6 +451,7 @@ void common_chat_peg_mapper::map(const common_peg_ast_node & node) {
result.tool_calls.push_back(pending_tool_call.value());
}
pending_tool_call.reset();
current_tool = nullptr;
}
}
}