mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-26 07:34:06 +00:00
Fix undefined behaviour reported by the new --enable-expensive-checks option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37829 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2672a8e407
commit
ea332946d3
@ -251,8 +251,9 @@ MemoryBuffer *MemoryBuffer::getSTDIN() {
|
||||
while (size_t ReadBytes = fread(Buffer, 1, 4096*4, stdin))
|
||||
FileData.insert(FileData.end(), Buffer, Buffer+ReadBytes);
|
||||
|
||||
FileData.push_back(0); // &FileData[Size] is invalid. So is &*FileData.end().
|
||||
size_t Size = FileData.size();
|
||||
MemoryBuffer *B = new STDINBufferFile();
|
||||
B->initCopyOf(&FileData[0], &FileData[Size]);
|
||||
B->initCopyOf(&FileData[0], &FileData[Size-1]);
|
||||
return B;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user