[PATCH] libdw: handle DW_FORM_indirect when reading attributes

Omar Sandoval osandov@osandov.com
Tue May 4 21:18:45 GMT 2021


On Sat, May 01, 2021 at 06:03:37PM +0200, Mark Wielaard wrote:
> Hi,
> 
> On Sat, 2021-05-01 at 17:59 +0200, Mark Wielaard wrote:
> > There is __libdw_form_val_compute_len which already handles
> > DW_FORM_indirect:
> > 
> >     case DW_FORM_indirect:
> >       get_uleb128 (u128, valp, endp);
> >       // XXX Is this really correct?
> >       result = __libdw_form_val_len (cu, u128, valp);
> >       if (result != (size_t) -1)
> >         result += valp - startp;
> >       else
> >         return (size_t) -1;
> >       break;
> > 
> > I believe the XXX question can be answered with: Yes, the result is the
> > size of the actual FORM data plus the size of the uleb128 encoding that
> > FORM (which is valp - startp). And it probably should check like your
> > code does that valp != DW_FORM_indirect && valp !=
> > DW_FORM_implicit_const. I'll sent a patch to do that.
> 
> Patch attached.

The patch looks reasonable to me, Mark, thanks.


More information about the Elfutils-devel mailing list