Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault in Debug::addr2line #23

Open
mmurrian opened this issue Jul 19, 2022 · 0 comments
Open

Segmentation fault in Debug::addr2line #23

mmurrian opened this issue Jul 19, 2022 · 0 comments

Comments

@mmurrian
Copy link

strstr(line, "\n") returns NULL if a newline is not found. Dereferencing without a NULL check causes a segmentation fault.

if (*(strstr(line, "\n") + 1) == '?') {

strcpy(strstr(line, "\n") + 1, image); // NOLINT(runtime/printf)

A bug in addr2line causes it to produce outputs such as the following for actually valid binaries:

addr2line: DWARF error: section .debug_info is larger than its filesize! (0x93ef57 vs 0x530ea0)\n

And for whatever reason, line will occasionally be read only partially through the pipe, e.g.:

addr2line: DWARF error: section .debug_info is larger than its filesize! (0x93ef57 vs 0x

I do not know whether the partial read is specifically related to this error or if it also happens with valid addr2line output. Either way, the partial read causes line not to have a trailing newline. Therefore, strstr returns NULL and the dereference of NULL + 1 causes a segmentation fault.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant