[llvm] r332866 - Fix ubsan bounds check failure.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Mon May 21 12:09:47 PDT 2018
Author: pcc
Date: Mon May 21 12:09:47 2018
New Revision: 332866
URL: http://llvm.org/viewvc/llvm-project?rev=332866&view=rev
Log:
Fix ubsan bounds check failure.
Modified:
llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp?rev=332866&r1=332865&r2=332866&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp Mon May 21 12:09:47 2018
@@ -365,7 +365,8 @@ bool X86AsmBackend::writeNopData(raw_ost
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);
More information about the llvm-commits
mailing list