[Bug libdw/26773] sleb128 values near INT64_MAX/MIN not correctly read

2020-10-23 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=26773 --- Comment #3 from Mark Wielaard --- (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_l

[Bug libdw/26773] sleb128 values near INT64_MAX/MIN not correctly read

2020-10-23 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=26773 --- Comment #4 from Mark Wielaard --- (In reply to Josh Stone from comment #2) > (In reply to Tom Tromey from comment #1) > > This limits the number of bytes read-- but it seems like > > it maybe ought to read until the first byte without the

[PATCH] Fix bug in read_3ubyte_unaligned_inc

2020-10-23 Thread Tom Tromey
The read_3ubyte_unaligned_inc macro calls read_2ubyte_unaligned, but it should call read_3ubyte_unaligned. Signed-off-by: Tom Tromey --- libdw/ChangeLog | 5 + libdw/memory-access.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog

[PATCH] Fix leb128 reading

2020-10-23 Thread Tom Tromey
PR 26773 points out that some sleb128 values are decoded incorrectly. Looking into this, I found some other unusual cases as well. In this patch, I chose to try to handle weird leb128 encodings by preserving their values when possible; or returning the maximum value on overflow. It isn't clear to