1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Fix ubsan bounds check failure.

llvm-svn: 332866
This commit is contained in:
Peter Collingbourne 2018-05-21 19:09:47 +00:00
parent 58b84296b9
commit 492891ef83

View File

@ -365,7 +365,8 @@ bool X86AsmBackend::writeNopData(raw_ostream &OS, uint64_t Count) const {
for (uint8_t i = 0; i < Prefixes; i++)
OS << '\x66';
const uint8_t Rest = ThisNopLength - Prefixes;
OS.write(Nops[Rest - 1], Rest);
if (Rest != 0)
OS.write(Nops[Rest - 1], Rest);
Count -= ThisNopLength;
} while (Count != 0);