diff options
author | Ian Lance Taylor <iant@golang.org> | 2024-07-11 19:29:04 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2024-07-11 19:34:45 -0700 |
commit | bf406a53693ef664b7ee0c77c4940a71a83866c5 (patch) | |
tree | c2f48a67295b26fbe38007200a291146577f5898 /libbacktrace/elf.c | |
parent | 3bc1a86d534db98d2e7647b734a198098f51267f (diff) | |
download | gcc-bf406a53693ef664b7ee0c77c4940a71a83866c5.zip gcc-bf406a53693ef664b7ee0c77c4940a71a83866c5.tar.gz gcc-bf406a53693ef664b7ee0c77c4940a71a83866c5.tar.bz2 |
libbacktrace: avoid infinite recursion
We could get an infinite recursion in an odd case in which a
.gnu_debugdata section was added to a debug file, and mini_debuginfo
was put into the debug file, and the debug file was put into a
/usr/lib/debug directory to be found by build ID. This combination
doesn't really make sense but we shouldn't get an infinite recursion.
* elf.c (elf_add): Don't use .gnu_debugdata if we are already
reading a debuginfo file.
* Makefile.am (m2test_*): New test targets.
(CHECK_PROGRAMS): Add m2test.
(MAKETESTS): Add m2test_minidebug2.
(%_minidebug2): New pattern.
(CLEANFILES): Remove minidebug2 files.
* Makefile.in: Regenerate.
Diffstat (limited to 'libbacktrace/elf.c')
-rw-r--r-- | libbacktrace/elf.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c index e6a66c0..107c968 100644 --- a/libbacktrace/elf.c +++ b/libbacktrace/elf.c @@ -6841,7 +6841,8 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor, } } - if (!gnu_debugdata_view_valid + if (!debuginfo + && !gnu_debugdata_view_valid && strcmp (name, ".gnu_debugdata") == 0) { if (!elf_get_view (state, descriptor, memory, memory_size, |