ianlancetaylor / libbacktrace

A C library that may be linked into a C/C++ program to produce symbolic backtraces

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segfault when used on ELF binary with section headers stripped

tmandry opened this issue · comments

When generating a backtrace for an ELF binary with section headers stripped, there's a segfault here:

libbacktrace/elf.c

Lines 2798 to 2800 in 5c88e09

shstrhdr = &shdrs[shstrndx - 1];
shstr_size = shstrhdr->sh_size;
shstr_off = shstrhdr->sh_offset;

Assuming shstrndx is nonzero can lead to underflow.