aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/MemoryBuffer.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2015-08-04 00:44:07 +0000
committerChandler Carruth <chandlerc@gmail.com>2015-08-04 00:44:07 +0000
commit630423e3797639336875edce07b4210dd2cf33a1 (patch)
tree5c22f898287d7011425aa1855767baaa860c362c /llvm/lib/Support/MemoryBuffer.cpp
parentb0ae36f0d1417136f1d38e69ee6504decbef8049 (diff)
downloadllvm-630423e3797639336875edce07b4210dd2cf33a1.zip
llvm-630423e3797639336875edce07b4210dd2cf33a1.tar.gz
llvm-630423e3797639336875edce07b4210dd2cf33a1.tar.bz2
[UB] Fix a nasty place where we would pass null pointers to memcpy.
This happens to work, but is not guaranteed to work. Indeed, most memcpy interfaces in Linux-land annotate these arguments as nonnull, and GCC and LLVM both can and do optimized based upon that. When they do so, they might legitimately have miscompiled code calling this routine with two valid iterators, 'nullptr' and 'nullptr'. There was even code doing precisely this because StringRef().begin() and StringRef().end() both produce null pointers. This was found by UBSan. llvm-svn: 243927
Diffstat (limited to 'llvm/lib/Support/MemoryBuffer.cpp')
0 files changed, 0 insertions, 0 deletions