]> granicus.if.org Git - clang/commit
Fix use-after-free bug in Tooling.
authorAlexander Kornienko <alexfh@google.com>
Tue, 8 Jan 2019 16:55:13 +0000 (16:55 +0000)
committerAlexander Kornienko <alexfh@google.com>
Tue, 8 Jan 2019 16:55:13 +0000 (16:55 +0000)
commit3957586ddbbd230dc6dcff6f187f11f013ab827d
tree9dd7edf46012795ed25fef95e9620fe1819fdbd6
parent24b21ed3f748f679552f56ffe65914d0108d4eca
Fix use-after-free bug in Tooling.

Summary:
`buildASTFromCodeWithArgs()` was creating a memory buffer referencing a
stack-allocated string.  This diff changes the implementation to copy the code
string into the memory buffer so that said buffer owns the memory.

Patch by Yitzhak Mandelbaum.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits, EricWF

Differential Revision: https://reviews.llvm.org/D55765

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350638 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Tooling/Tooling.h
lib/Tooling/Tooling.cpp
unittests/Analysis/ExprMutationAnalyzerTest.cpp