diff options
author | Alan Modra <amodra@gmail.com> | 2021-05-15 14:37:42 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-05-15 14:38:42 +0930 |
commit | ebb17864920d1b15f3c392ce5cd22ddee169e825 (patch) | |
tree | 3b21857c5fbc1a909dfcdd6096a2f64eccd839ca /binutils/dwarf.c | |
parent | fc5e0925d4bff79c8c036cf00803112a1ec04188 (diff) | |
download | gdb-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/dwarf.c')
-rw-r--r-- | binutils/dwarf.c | 5 |
1 files changed, 4 insertions, 1 deletions
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) \ |