SAFE_BYTE_GET_INTERNAL
authorAlan Modra <amodra@gmail.com>
Sat, 15 May 2021 05:07:42 +0000 (14:37 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 15 May 2021 05:08:42 +0000 (14:38 +0930)
We won't want this assert triggering in the next release.

* dwarf.c (SAFE_BYTE_GET_INTERNAL): Assert only when ENABLE_CHECKING.

binutils/ChangeLog
binutils/dwarf.c

index 74efc3376ebcbcad79b1266c72c2b5487f858c04..691fdfcb704d78b6cbda54d681e287818bff868d 100644 (file)
@@ -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.
index 020b7e071ec22f36906a1ad4535c79d343065a40..3a1c18e082f49413426792345a691838e341068f 100644 (file)
@@ -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)                                                 \