]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdw/
authorRoland McGrath <roland@redhat.com>
Thu, 5 Apr 2007 09:27:36 +0000 (09:27 +0000)
committerRoland McGrath <roland@redhat.com>
Thu, 5 Apr 2007 09:27:36 +0000 (09:27 +0000)
2007-04-05  Roland McGrath  <roland@redhat.com>

* 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é <sebastien.dugue@bull.net>.

libdw/ChangeLog
libdw/dwarf_ranges.c

index c5a7f8f979ea9c0036c043a92af2cc8376921435..5d55dee2eb622c88a33f45fab346d2e7287184b6 100644 (file)
@@ -1,3 +1,9 @@
+2007-04-05  Roland McGrath  <roland@redhat.com>
+
+       * 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é <sebastien.dugue@bull.net>.
+
 2007-03-25  Roland McGrath  <roland@redhat.com>
 
        * dwarf_begin_elf.c (check_section): Return Dwarf * instead of void.
index 57788da0f7ad29beae7321e0656af4546227c11e..89da0af4d95a3e044588c5a01ec28bdf5c790d47 100644 (file)
@@ -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.  */