This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [PATCH 1/4] default_debugscn_p: Add support for compressed debug section.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Mon, 13 Aug 2012 13:36:10 +0200
- Subject: Re: [PATCH 1/4] default_debugscn_p: Add support for compressed debug section.
On Sun, Aug 12, 2012 at 06:28:59PM +0200, Kurt Roeckx wrote:
> @@ -657,7 +657,13 @@ default_debugscn_p (const char *name)
> const size_t ndwarf_scn_names = (sizeof (dwarf_scn_names)
> / sizeof (dwarf_scn_names[0]));
> for (size_t cnt = 0; cnt < ndwarf_scn_names; ++cnt)
> - if (strcmp (name, dwarf_scn_names[cnt]) == 0)
> + if (strcmp (name, dwarf_scn_names[cnt]) == 0
> +#if USE_ZLIB
> + || (name[0] == '.' && name[1] == 'z'
> + && dwarf_scn_names[cnt][1] == 'd'
> + && strcmp (&name[2], &dwarf_scn_names[cnt][1]) == 0)
> +#endif
I don't think it is necessary to depend on USE_ZLIB here, we are
just checking the name, not the content anyway.
I am a little worried this might now return true for cases that the
caller might not be prepared to handle. If the Elf was opened through
libdwfl the section would be automagically decompressed, but
See for example strip, which might try to read the data "raw" when
--reloc-debug-sections is given.
So this might be a good time to audit all callers and make sure they
won't choke on finding compressed data in the elf section.
Cheers,
Mark