OSDN Git Service

[dsymutil] Prevent use-after-free
authorFrederic Riss <friss@apple.com>
Mon, 9 May 2016 14:44:14 +0000 (14:44 +0000)
committerFrederic Riss <friss@apple.com>
Mon, 9 May 2016 14:44:14 +0000 (14:44 +0000)
commit856a0143b0b25c58f726d66f222cec00b4185c61
treec1127ca363e8cd793225f6df21310ca2db03394c
parentee2078606f128639f04e263c2611ac431b040673
[dsymutil] Prevent use-after-free

The BinaryHolder would query the archive member MemoryBuffer name
to check if the current open archive also contains the next requested
objectfile. This comparison was using a StringRef to a temporary
buffer. It only happened with fat archives. This commit adds long-lived
storage along with the MemoryBuffers for the fat archive filename.

The added test would fail during an ASAN build without the fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268924 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/dsymutil/Inputs/basic-with-libfat-test.macho.x86_64 [new file with mode: 0755]
test/tools/dsymutil/X86/basic-with-libfat-test.test [new file with mode: 0644]
tools/dsymutil/BinaryHolder.cpp
tools/dsymutil/BinaryHolder.h