[analyzer] Make MallocChecker more robust against custom redeclarations
authorDevin Coughlin <dcoughlin@apple.com>
Sun, 16 Oct 2016 17:26:06 +0000 (17:26 +0000)
committerDevin Coughlin <dcoughlin@apple.com>
Sun, 16 Oct 2016 17:26:06 +0000 (17:26 +0000)
commit62ce463a35d7d0dd919672a0a824352b1847de06
treebd9e496b6e03db0fcde75837d52c69f9e03834e0
parentc5777f4d580a37f073b0351de26711d789433486
[analyzer] Make MallocChecker more robust against custom redeclarations

Add additional checking to MallocChecker to avoid crashing when memory
routines have unexpected numbers of arguments. You wouldn't expect to see much
of this in normal code (-Wincompatible-library-redeclaration warns on this),
but, for example, CMake tests can generate these.

This is PR30616.

rdar://problem/28631974

llvm-svn: 284335
clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
clang/test/Analysis/malloc-custom.c [new file with mode: 0644]