[PATCH 02/19] SAFE_BYTE_GET_INTERNAL
Alan Modra
amodra@gmail.com
Sat May 15 08:09:40 GMT 2021
We won't want this assert triggering in the next release.
* dwarf.c (SAFE_BYTE_GET_INTERNAL): Assert only when ENABLE_CHECKING.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 020b7e071ec..3a1c18e082f 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -390,8 +390,11 @@ read_leb128 (unsigned char *data,
(int) amount, (int) sizeof (VAL)); \
amount = sizeof (VAL); \
} \
- assert ((PTR) <= (END)); \
+ if (ENABLE_CHECKING) \
+ assert ((PTR) <= (END)); \
size_t avail = (END) - (PTR); \
+ if ((PTR) > (END)) \
+ avail = 0; \
if (amount > avail) \
amount = avail; \
if (amount == 0) \
More information about the Binutils
mailing list