OSDN Git Service

[UB] Don't allocate space for contained types and then try to copy the
authorChandler Carruth <chandlerc@gmail.com>
Tue, 4 Aug 2015 03:48:26 +0000 (03:48 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 4 Aug 2015 03:48:26 +0000 (03:48 +0000)
commit1a092e8289d0572ba77aaa769e30896e390d25b9
treea2b6463a9fff68eeaadbc6dcd9114d949adcb561
parent56880d0733c6b485b79e6b411d388cd9bc1f66bc
[UB] Don't allocate space for contained types and then try to copy the
contained types into the space when we have no contained types. This
fixes the UB stemming from a call to memcpy with a null pointer. This
also reduces the calls to allocate because this actually happens in
a notable client - Clang.

Found by UBSan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243944 91177308-0d34-0410-b5e6-96231b3b80d8
lib/IR/Type.cpp