aboutsummaryrefslogtreecommitdiff
path: root/binutils/dwarf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-08-29 09:04:08 +0930
committerAlan Modra <amodra@gmail.com>2019-08-29 09:04:35 +0930
commita85eba51f619d3e8c813a12871172f23689b28d6 (patch)
tree2e1ecfbaf00869124544c05344e2d07d201a4618 /binutils/dwarf.c
parent83cf0d04dcdc9a4e7f105a517390e4c1af444340 (diff)
downloadgdb-a85eba51f619d3e8c813a12871172f23689b28d6.zip
gdb-a85eba51f619d3e8c813a12871172f23689b28d6.tar.gz
gdb-a85eba51f619d3e8c813a12871172f23689b28d6.tar.bz2
Tidy check_uvalue
I don't see a need to calculate "ptr = start + uvalue" then compare "ptr" with "start" and "end". Given "start <= end" on entry, the "uvalue" comparison with "max_uvalue" ought to be sufficient to ensure "start + uvalue" is bounded by "start" and "end" regardless of the size of pointers and the unsigned dwarf_vma integer type. * dwarf.c (check_uvalue): Remove unnecessary pointer checks.
Diffstat (limited to 'binutils/dwarf.c')
-rw-r--r--binutils/dwarf.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 19ae1ed..df924e4 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -1848,16 +1848,9 @@ check_uvalue (const unsigned char * start,
{
dwarf_vma max_uvalue = end - start;
- /* FIXME: Testing "(start + uvalue) < start" miscompiles with gcc 4.8.3
- running on an x86_64 host in 32-bit mode. So we pre-compute the value
- here. */
- const unsigned char * ptr = start + uvalue;
-
/* See PR 17512: file: 008-103549-0.001:0.1.
and PR 24829 for examples of where these tests are triggered. */
- if (uvalue > max_uvalue
- || ptr > end
- || ptr < start)
+ if (uvalue > max_uvalue)
{
warn (_("Corrupt attribute block length: %lx\n"), (long) uvalue);
uvalue = max_uvalue;