Re: [PATCH] readelf: Save and dump the original section header values

"H.J. Lu" <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <CAMe9rOomdPntk8J_3Q3O4DMtigxTYP_BRGgFO+T7SbKaEeU6aw@mail.gmail.com>
On Sat, Jul 4, 2026 at 7:49 AM Alan Modra <[email protected]> wrote:
>
> On Fri, Jul 03, 2026 at 10:30:14PM +0800, H.J. Lu wrote:
> > validate_section_info clears the garbage values in the section header
> > to avoid crash later.  Save and dump the original section header values
> > to make the garbage values in the section header visible when dumping
> > section headers.
>
> I think this would be better done the other way around.  ie. have a
> Elf_Internal_Shdr **sane_section_headers that is initialised to point
> at entries in section_headers, with sane_section_headers[i] allocated
> as necessary when needing to correct a bogus header.
>

I have thought about something similar and decided against it
since filedata->section_headers is used in many places.   However,
I can change filedata->orig_section_headers to on demand.

-- 
H.J.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.