This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][V2] Change calling convention of dwarf_getmacros to allow opcode 0xff


On Wed, 2014-12-10 at 01:45 +0100, Petr Machata wrote:
> It might happen for macro sections that are larger than half of host
> address space (e.g. 2G for 32-bit libdw).  The offset would then be
> negative, but adding it to the data start would wrap around and do the
> right thing, I think.  So it's the fact that we need that one bit for
> something else that's limiting us here.
> 
> How about this?
> 
> diff --git a/libdw/dwarf_getmacros.c b/libdw/dwarf_getmacros.c
> index 0ba3854..bd64d60 100644
> --- a/libdw/dwarf_getmacros.c
> +++ b/libdw/dwarf_getmacros.c
> @@ -407,7 +407,11 @@ token_from_offset (ptrdiff_t offset, bool accept_0xff)
>      return offset;
>  
>    /* Make sure the offset didn't overflow into the flag bit.  */
> -  assert ((offset & DWARF_GETMACROS_START) == 0);
> +  if ((offset & DWARF_GETMACROS_START) != 0)
> +    {
> +      __libdw_seterrno (DWARF_E_TOO_BIG);
> +      return -1;
> +    }

Perfect.

Thanks,

Mark

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]