From bf2ee480165faec726d678f189acd2bd54e07573 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 5 Apr 2007 09:27:36 +0000 Subject: [PATCH] libdw/ 2007-04-05 Roland McGrath MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * dwarf_ranges.c (dwarf_ranges): Don't sign-extend 32-bit BEGIN address to check for all-ones base address entry. Check directly. Reported by Sébastien Dugué . --- libdw/ChangeLog | 6 ++++++ libdw/dwarf_ranges.c | 21 ++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index c5a7f8f97..5d55dee2e 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,9 @@ +2007-04-05 Roland McGrath + + * dwarf_ranges.c (dwarf_ranges): Don't sign-extend 32-bit BEGIN + address to check for all-ones base address entry. Check directly. + Reported by Sébastien Dugué . + 2007-03-25 Roland McGrath * dwarf_begin_elf.c (check_section): Return Dwarf * instead of void. diff --git a/libdw/dwarf_ranges.c b/libdw/dwarf_ranges.c index 57788da0f..89da0af4d 100644 --- a/libdw/dwarf_ranges.c +++ b/libdw/dwarf_ranges.c @@ -1,5 +1,5 @@ /* Enumerate the PC ranges covered by a DIE. - Copyright (C) 2005 Red Hat, Inc. + Copyright (C) 2005, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -141,18 +141,21 @@ dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep, { begin = read_8ubyte_unaligned_inc (die->cu->dbg, readp); end = read_8ubyte_unaligned_inc (die->cu->dbg, readp); + if (begin == (uint64_t) -1l) /* Base address entry. */ + { + *basep = end; + goto next; + } } else { - begin = (Dwarf_Sword) read_4sbyte_unaligned_inc (die->cu->dbg, - readp); + begin = read_4ubyte_unaligned_inc (die->cu->dbg, readp); end = read_4ubyte_unaligned_inc (die->cu->dbg, readp); - } - - if (begin == (Dwarf_Addr) -1l) /* Base address entry. */ - { - *basep = end; - goto next; + if (begin == (uint32_t) -1) /* Base address entry. */ + { + *basep = end; + goto next; + } } if (begin == 0 && end == 0) /* End of list entry. */ -- 2.47.2