llvm.org GIT mirror llvm / 5f4aba6
raw_ostream::operator<<(StringRef): Avoid potential overflow in pointer arithmetic. (OutBufCur + Size) might overflow if Size were large. For example on i686-linux, OutBufCur: 0xFFFDF27D OutBufEnd: 0xFFFDF370 Size: 0x0002BF20 (180,000) It caused flaky error in MC/COFF/section-name-encoding.s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207621 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 5 years ago
1 changed file(s) with 1 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
161161 size_t Size = Str.size();
162162
163163 // Make sure we can use the fast path.
164 if (OutBufCur+Size > OutBufEnd)
164 if (Size > (size_t)(OutBufEnd - OutBufCur))
165165 return write(Str.data(), Size);
166166
167167 memcpy(OutBufCur, Str.data(), Size);