mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-23 20:15:35 +00:00
added an assertion to MCObjectWriter::WriteBytes to catch misuse of the ZeroFillSize parameter
If the size of the string is greater than the zero fill size, the function will attempt to write a very large string of zeros to the object file (~4GB on 32 bit platforms). This assertion will catch the scenario and crash the program before the write occurs. llvm-svn: 104334
This commit is contained in:
parent
4c14d2c4a4
commit
28b485543b
@ -152,6 +152,8 @@ public:
|
||||
}
|
||||
|
||||
void WriteBytes(StringRef Str, unsigned ZeroFillSize = 0) {
|
||||
assert((ZeroFillSize == 0 || Str.size () <= ZeroFillSize) &&
|
||||
"data size greater than fill size, unexpected large write will occur");
|
||||
OS << Str;
|
||||
if (ZeroFillSize)
|
||||
WriteZeros(ZeroFillSize - Str.size());
|
||||
|
Loading…
Reference in New Issue
Block a user