From: Benjamin Kramer Date: Wed, 23 Jan 2019 14:51:21 +0000 (+0000) Subject: [AArch64] Fix out of bounds strlen X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aa39b014ee47425d39409dc4ad52360ce47d9844;p=llvm [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351955 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/AArch64/AArch64FrameLowering.cpp b/lib/Target/AArch64/AArch64FrameLowering.cpp index 374056f9899..8b199fc091a 100644 --- a/lib/Target/AArch64/AArch64FrameLowering.cpp +++ b/lib/Target/AArch64/AArch64FrameLowering.cpp @@ -1775,8 +1775,8 @@ bool AArch64FrameLowering::spillCalleeSavedRegisters( static_cast(unsigned(dwarf::DW_OP_breg18)), static_cast(-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);