[Bug libdw/26773] sleb128 values near INT64_MAX/MIN not correctly read
mark at klomp dot org
Fri Oct 23 15:57:07 GMT 2020
--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Tom Tromey from comment #1)
> I looked at this a little today.
> In addition to this bug, I think the _unchecked variants
> have another bug; namely they do:
> const size_t max = len_leb128 (int64_t) - 1;
> This limits the number of bytes read-- but it seems like
> it maybe ought to read until the first byte without the
> high bit set.
Yes, that is the bug (plus the same -1 we do inside __libdw_max_len_sleb128 for
the "checked" variant.
> FWIW gdb seems to rely on implementation-defined behavior
> here. It does all the sleb work in an unsigned type
> and then casts it to signed on return.
That would probably work. Is the implementation-defined part that it depends on
signed numbers being represented as Two's complement? In that case I think we
are fine with that as fix.
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Elfutils-devel