Avoid possible pointer wrap
authorAlan Modra <amodra@gmail.com>
Mon, 10 May 2021 00:26:43 +0000 (09:56 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 10 May 2021 00:33:00 +0000 (10:03 +0930)
commit2d4b49864eba70606b1bee3d0a3e8414189dcd6d
treef3a8c3cd72a12ea0b3181a388beea89de5ac7448
parent400f0c9b88c68784f9c516422f293bc4d19d9e5b
Avoid possible pointer wrap

PTR supplied to these macros can be read from user input, END is an
end of buffer pointer.  It's safer to do arithmetic on END than on PTR.

* dwarf.c (SAFE_BYTE_GET): Check bounds by subtracting amount from
END rather than adding amount to PTR.
(SAFE_SIGNED_BYTE_GET, SAFE_BYTE_GET64): Likewise.
binutils/ChangeLog
binutils/dwarf.c