[analyzer] Improve subscripting null arrays for catching null dereferences.
authorArtem Dergachev <artem.dergachev@gmail.com>
Mon, 24 Apr 2017 20:55:07 +0000 (20:55 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Mon, 24 Apr 2017 20:55:07 +0000 (20:55 +0000)
commitcbd7cd8360d9bd6c5a083acbf8e63dbc9690e975
tree904be8d7f31954126189b28e0dd2b9effc8147a3
parent9e32aa2587b540592c2a32f7f4885b9278ef6ba4
[analyzer] Improve subscripting null arrays for catching null dereferences.

Array-to-pointer cast now works correctly when the pointer to the array
is concrete, eg. null, which allows further symbolic calculations involving
such values.

Inlined defensive checks are now detected correctly when the resulting null
symbol is being array-subscripted before dereference.

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

llvm-svn: 301251
clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
clang/lib/StaticAnalyzer/Core/RegionStore.cpp
clang/test/Analysis/null-deref-offsets.c