aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-05-15 14:37:42 +0930
committerAlan Modra <amodra@gmail.com>2021-05-15 14:38:42 +0930
commitebb17864920d1b15f3c392ce5cd22ddee169e825 (patch)
tree3b21857c5fbc1a909dfcdd6096a2f64eccd839ca /binutils
parentfc5e0925d4bff79c8c036cf00803112a1ec04188 (diff)
downloadgdb-ebb17864920d1b15f3c392ce5cd22ddee169e825.zip
gdb-ebb17864920d1b15f3c392ce5cd22ddee169e825.tar.gz
gdb-ebb17864920d1b15f3c392ce5cd22ddee169e825.tar.bz2
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.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog4
-rw-r--r--binutils/dwarf.c5
2 files changed, 8 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 74efc33..691fdfc 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,9 @@
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.
* dwarf.c (get_encoded_value): Avoid pointer UB.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 020b7e0..3a1c18e 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) \