llvm-project/llvm/test/tools/llvm-symbolizer
Adrian Prantl bbe980dfe1 Fix computeSymbolSizes SEGFAULT on invalid file
We use llvm-symbolizer in some production systems, and we run it
against all possibly related files, including some that are not
ELF. We noticed that for some of those invalid files, llvm-symbolizer
would crash with SEGFAULT. Here is an example of such a file.

It is due to that in computeSymbolSizes, a loop uses condition

  for (unsigned I = 0, N = Addresses.size() - 1; I < N; ++I) {

where if Addresses.size() is 0, N would overflow and causing the loop
to access invalid memory.

Instead of patching the loop conditions, the commit makes so that the
function returns early if Addresses is empty.

Validated by checking that llvm-symbolizer no longer crashes.

Patch by Teng Qin!

Differential Revision: https://reviews.llvm.org/D44285

llvm-svn: 330610
2018-04-23 16:08:01 +00:00
..
Inputs llvm-symbolizer/print_context.c test: Make debug info path independent 2017-07-30 17:26:34 +00:00
pdb [lit] Fix a problem with spaces in the python path by adding quotes around it 2018-02-21 00:41:30 +00:00
coff-dwarf.test [llvm-symbolizer] Fix coff-dwarf.test 2017-09-16 19:01:04 +00:00
coff-exports.test
dsym.test
fat.test
padding-x86_64.ll Using address range map to speedup finding inline stack for address. 2017-04-19 20:09:38 +00:00
ppc64.test [lit] Fix a problem with spaces in the python path by adding quotes around it 2018-02-21 00:41:30 +00:00
print_context.c Get rid of even more "%T" expansions, see <https://reviews.llvm.org/D35396>. 2017-08-20 17:05:22 +00:00
split-debug.test [llvm-symbolizer] Use correct path when resolving .gnu_debuglink in .debug 2018-03-02 22:56:45 +00:00
sym-verbose.test Update the test to fix the buildbot failure introduced by r300486 (NFC) 2017-04-17 20:35:32 +00:00
sym.test Fix computeSymbolSizes SEGFAULT on invalid file 2018-04-23 16:08:01 +00:00