[binutils-gdb] SAFE_BYTE_GET_INTERNAL
Alan Modra
amodra@sourceware.org
Sat May 15 08:12:17 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ebb17864920d1b15f3c392ce5cd22ddee169e825
commit ebb17864920d1b15f3c392ce5cd22ddee169e825
Author: Alan Modra <amodra@gmail.com>
Date: Sat May 15 14:37:42 2021 +0930
SAFE_BYTE_GET_INTERNAL
We won't want this assert triggering in the next release.
* dwarf.c (SAFE_BYTE_GET_INTERNAL): Assert only when ENABLE_CHECKING.
Diff:
---
binutils/ChangeLog | 4 ++++
binutils/dwarf.c | 5 ++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 74efc3376eb..691fdfcb704 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-15 Alan Modra <amodra@gmail.com>
+
+ * dwarf.c (SAFE_BYTE_GET_INTERNAL): Assert only when ENABLE_CHECKING.
+
2021-05-15 Alan Modra <amodra@gmail.com>
* bucomm.h (_mul_overflow): Define.
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-cvs
mailing list