From: Rafael Espindola Date: Tue, 7 Jul 2015 19:00:02 +0000 (+0000) Subject: Don't pass a null pointer to memcpy. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=51f5a1a8fee29bd2414b8799f3120cc0746ed906;p=oota-llvm.git Don't pass a null pointer to memcpy. Fixes pr23650. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241617 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h index b59317112c4..28e512c8694 100644 --- a/include/llvm/Support/raw_ostream.h +++ b/include/llvm/Support/raw_ostream.h @@ -165,8 +165,10 @@ public: if (Size > (size_t)(OutBufEnd - OutBufCur)) return write(Str.data(), Size); - memcpy(OutBufCur, Str.data(), Size); - OutBufCur += Size; + if (Size) { + memcpy(OutBufCur, Str.data(), Size); + OutBufCur += Size; + } return *this; }