]> granicus.if.org Git - clang/commit
[ASTUnit] Fix use-after-free bug in ASTUnit::getMainBufferWithPrecompiledPreamble().
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 27 Feb 2014 04:11:59 +0000 (04:11 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 27 Feb 2014 04:11:59 +0000 (04:11 +0000)
commit0242440d9fdc32a81fa397445d5a8b599875e446
tree2623bc10d748085b2db647311c1dd9ffaf6ef17a
parent70549826ec94c46f875cd4ec0429d44bb388ab65
[ASTUnit] Fix use-after-free bug in ASTUnit::getMainBufferWithPrecompiledPreamble().

With r197755 we started reading the contents of buffer file entries, but the
buffers may point to ASTReader blobs that have been disposed.

Fix this by having the CompilerInstance object keep a reference to the ASTReader
as well as having the ASTContext keep reference to the ExternalASTSource.

This was very difficult to construct a test case for.
rdar://16149782

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202346 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/ASTContext.h
include/clang/AST/ExternalASTSource.h
include/clang/Frontend/ASTUnit.h
include/clang/Frontend/ChainedIncludesSource.h
include/clang/Frontend/CompilerInstance.h
lib/AST/ASTContext.cpp
lib/Frontend/ASTUnit.cpp
lib/Frontend/ChainedIncludesSource.cpp
lib/Frontend/CompilerInstance.cpp
lib/Frontend/FrontendAction.cpp