Re: [PATCH 1/2 v2] Don't overflow in __libdw_in_section

2017-12-14 Thread Ulf Hermann
On 12/14/2017 02:43 PM, Mark Wielaard wrote:
> (Meta, I have some trouble applying this with git am, it thinks the
> patch is malformed. But I can apply by hand of course.)

Oh, sorry for that. It's probably the leading spaces again. I keep messing up 
my mail setup on windows ...

> The transformation seems correct. But if we can overflow/underflow
> here, do we have the same problem in __libdw_offset_in_section where we
>   check data->d_size - offset < size, with offset a Dwarf_Off?

Probably we have the same problem there. I didn't catch any instances of it, 
though.

regards,
Ulf


Re: [PATCH 2/2 v2] Generalize cu_sec_idx

2017-12-14 Thread Ulf Hermann
On 12/14/2017 02:51 PM, Mark Wielaard wrote:
> This is clever and indeed cu_sec_idx () is not generic enough.
> But this is also somewhat inefficient. I am working on DWARF5 support
> and there a CU can come from even more different sections (or file). So
> I am changing Dwarf_CU to have an explicit section to which is it is
> associated. This can then also be used by the "fake" CUs like created
> in dwarf_getmacros.

Mind that the two most common cases are 0 and 1. In fact nothing else was 
supported before this change. So, most of the time this will not do a lot of 
iteration.

regards,
Ulf