Re: [PATCH] [dwarf2read] Fix crash when loading dwp files: calculate num_sections based on actual section indices, not just the number of sections.

Simon Marchi
2019-02-26T16:24:41Z

On 2019-02-26 10:08, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
>
>>> - dwp_file->num_sections = bfd_count_sections (dwp_file->dbfd) + 1;
>>> + dwp_file->num_sections = elf_numsections (dwp_file->dbfd);
>
> Simon> I have tweaked the original commit message a bit and pushed.
> Simon> Thanks again for the patch.
>
> I wonder if there's any way to reach this with a non-ELF objfile --
> Mach-O seems probable. I think we also handle DWARF on AIX (ECOFF
> IIRC)
> but I don't know if that does dwp.

Oh, maybe. Unfortunately, I don't have access to a Mac to test this at
the moment.

I'll give it a try on gcc119.fsffrance.org for AIX.

Simon