mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 06:31:18 +00:00
Fix integer overflow bug in raw_ostream::write. This showed up as a
non-deterministic crash in the test suite. Fixes PR10055! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138717 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f5ec9b55e8
commit
b1b051ec97
@ -284,7 +284,7 @@ raw_ostream &raw_ostream::write(unsigned char C) {
|
||||
|
||||
raw_ostream &raw_ostream::write(const char *Ptr, size_t Size) {
|
||||
// Group exceptional cases into a single branch.
|
||||
if (BUILTIN_EXPECT(OutBufCur+Size > OutBufEnd, false)) {
|
||||
if (BUILTIN_EXPECT(size_t(OutBufEnd - OutBufCur) < Size, false)) {
|
||||
if (BUILTIN_EXPECT(!OutBufStart, false)) {
|
||||
if (BufferMode == Unbuffered) {
|
||||
write_impl(Ptr, Size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user