mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-06 04:31:08 +00:00
Add a sanity check in MemoryBuffer::getOpenFile() to make sure we don't hang
if the passed in FileSize is inaccurate. rdar://11034179 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152662 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e4c972d864
commit
b9153bacd0
@ -336,7 +336,11 @@ error_code MemoryBuffer::getOpenFile(int FD, const char *Filename,
|
|||||||
// Error while reading.
|
// Error while reading.
|
||||||
return error_code(errno, posix_category());
|
return error_code(errno, posix_category());
|
||||||
}
|
}
|
||||||
assert(NumRead != 0 && "fstat reported an invalid file size.");
|
if (NumRead == 0) {
|
||||||
|
assert(0 && "We got inaccurate FileSize value or fstat reported an "
|
||||||
|
"invalid file size.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
BytesLeft -= NumRead;
|
BytesLeft -= NumRead;
|
||||||
BufPtr += NumRead;
|
BufPtr += NumRead;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user