diff options
author | Fangrui Song <maskray@google.com> | 2018-01-08 18:57:38 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2018-01-08 18:57:38 +0000 |
commit | e61045feb379ef9d17a08d3d92bbaee3785995b9 (patch) | |
tree | 33dca5a7f100af945f9ce409be043925ff54d4a1 /libcxx/include/algorithm | |
parent | 7dfe96ad16734766bc061224a56b576fdea0af17 (diff) | |
download | bcm5719-llvm-e61045feb379ef9d17a08d3d92bbaee3785995b9.tar.gz bcm5719-llvm-e61045feb379ef9d17a08d3d92bbaee3785995b9.zip |
[index] Return when DC is null in handleReference
Summary:
DC may sometimes be NULL and getContainerInfo(DC, Container) will dereference a null pointer.
Default template arguments (the following example and many test files in https://github.com/nlohmann/json)
may cause null pointer dereference.
```c++
template <typename>
struct actor;
template <template <typename> class Actor = actor>
struct terminal;
```
In tools/libclang/CXIndexDataConsumer.cpp#L203
handleReference(ND, Loc, Cursor,
dyn_cast_or_null<NamedDecl>(ASTNode.Parent),
ASTNode.ContainerDC, ASTNode.OrigE, Kind);
`dyn_cast_or_null<NamedDecl>(ASTNode.Parent)` is somehow a null pointer and in tools/libclang/CXIndexDataConsumer.cpp:935
ContainerInfo Container;
getContainerInfo(DC, Container);
The null DC is casted `ContInfo.cursor = getCursor(cast<Decl>(DC));` and SIGSEGV.
```
See discussions in https://github.com/jacobdufault/cquery/issues/219 https://github.com/jacobdufault/cquery/issues/192
Reviewers: akyrtzi, sammccall, yvvan
Reviewed By: sammccall
Subscribers: mehdi_amini, cfe-commits
Differential Revision: https://reviews.llvm.org/D41575
llvm-svn: 322017
Diffstat (limited to 'libcxx/include/algorithm')
0 files changed, 0 insertions, 0 deletions