[AArch64] Fix out of bounds strlen

CFIInst is not zero-terminated. This is one of more annoying functional
differences between StringRef and ArrayRef.

Found by asan.

llvm-svn: 351955
This commit is contained in:
Benjamin Kramer 2019-01-23 14:51:21 +00:00
parent c7956346da
commit 4ebed81fc4
1 changed files with 2 additions and 2 deletions

View File

@ -1775,8 +1775,8 @@ bool AArch64FrameLowering::spillCalleeSavedRegisters(
static_cast<char>(unsigned(dwarf::DW_OP_breg18)),
static_cast<char>(-8) & 0x7f, // addend (sleb128)
};
unsigned CFIIndex =
MF.addFrameInst(MCCFIInstruction::createEscape(nullptr, CFIInst));
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createEscape(
nullptr, StringRef(CFIInst, sizeof(CFIInst))));
BuildMI(MBB, MI, DL, TII.get(AArch64::CFI_INSTRUCTION))
.addCFIIndex(CFIIndex)
.setMIFlag(MachineInstr::FrameSetup);