On Sat, 2014-02-22 at 22:08 +0100, Jan Kratochvil wrote:
> probably obvious, easy to debug with [patch 3/3] applied.
>
> > 2014-02-22  Jan Kratochvil  <[email protected]>
> > 
> >     Fix abort() on missing section headers.
> >     * dwarf_begin_elf.c (check_section): Replace abort call by a return;
> > [...]
> > @@ -187,9 +187,9 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn 
> > *scn, bool inscngrp)
> >    /* Get the section header data.  */
> >    shdr = gelf_getshdr (scn, &shdr_mem);
> >    if (shdr == NULL)
> > -    /* This should never happen.  If it does something is
> > -       wrong in the libelf library.  */
> > -    abort ();
> > +    /* We may read /proc/PID/mem with only program headers mapped and 
> > section
> > +       headers out of the mapped pages.  */
> > +    return result;

We certainly shouldn't abort on bad data!
But do we even need to continue at this point?

return result; means we will keep searching through the section table,
which apparently is busted anyway. So I think it makes sense to cleanup
and return NULL; instead.

See how we cleanup and return NULL just below this code when elf_strptr
fails.

Thanks,

Mark

Reply via email to