android_system_core/libunwindstack
Christopher Ferris 8726d3a448 Fix handling of possible bad gnu_debugdata_size.
Rather than use a std::vector for backing memory, allocate the memory
using a new with nothrow, and in MemoryBuffer use realloc. Since
the size field is coming from the elf, it could be corrupted or
intentionally crafted to cause problems.

In addition, add some other protections to make sure that overflows
don't occur.

Bug: 146215949

Test: Ran unit tests with jemalloc and scudo to verify that they
Test: both behave the same way.
Change-Id: If14243ce382ba5403a6bacd0ec673452c6b7c3be
2019-12-19 16:48:15 -08:00
..
benchmarks
include/unwindstack
tests
tools
.clang-format
Android.bp
AndroidVersions.md
ArmExidx.cpp
ArmExidx.h
AsmGetRegsMips.S
AsmGetRegsMips64.S
AsmGetRegsX86.S
AsmGetRegsX86_64.S
Check.h
DexFile.cpp
DexFile.h
DexFiles.cpp
DwarfCfa.cpp
DwarfCfa.h
DwarfDebugFrame.h
DwarfEhFrame.h
DwarfEhFrameWithHdr.cpp
DwarfEhFrameWithHdr.h
DwarfEncoding.h
DwarfMemory.cpp
DwarfOp.cpp
DwarfOp.h
DwarfSection.cpp
Elf.cpp
ElfInterface.cpp
ElfInterfaceArm.cpp
ElfInterfaceArm.h
Global.cpp
JitDebug.cpp
LocalUnwinder.cpp
Log.cpp
MapInfo.cpp
Maps.cpp
Memory.cpp
MemoryBuffer.h
MemoryCache.h
MemoryFileAtOffset.h
MemoryLocal.h
MemoryOffline.h
MemoryOfflineBuffer.h
MemoryRange.h
MemoryRemote.h
OWNERS
Regs.cpp
RegsArm.cpp
RegsArm64.cpp
RegsInfo.h
RegsMips.cpp
RegsMips64.cpp
RegsX86.cpp
RegsX86_64.cpp
Symbols.cpp
Symbols.h
TEST_MAPPING
Unwinder.cpp