]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Handle zero-length address ranges
authorPetr Machata <pmachata@redhat.com>
Wed, 8 Apr 2009 13:33:52 +0000 (15:33 +0200)
committerPetr Machata <pmachata@redhat.com>
Fri, 10 Apr 2009 13:43:26 +0000 (15:43 +0200)
src/dwarflint.c

index 20189b0f84f63e7f08a3c1185b2512a9a083c04d..6b18e5718b6652ac3d22872a1b3171832266b113 100644 (file)
@@ -2317,11 +2317,12 @@ coverage_map_add (struct coverage_map *coverage_map,
     wr_error (where,
              ": couldn't find a section that the range %#"
              PRIx64 "..%#" PRIx64 " covers.\n", address, end);
-  else
+  else if (length > 0)
     {
       bool range_hole (uint64_t h_start, uint64_t h_length,
                       void *user __attribute__ ((unused)))
       {
+       assert (h_length != 0);
        wr_error (where,
                  ": portion %#" PRIx64 "..%#" PRIx64
                  ", of the range %#" PRIx64 "..%#" PRIx64
@@ -3903,8 +3904,13 @@ check_aranges_structural (struct section_data *data, struct cu *cu_chain)
          if (address == 0 && length == 0 && !address_relocated)
            break;
 
-         /* Skip coverage analysis if we have errors.  */
-         if (retval)
+         if (length == 0)
+           /* DWARF 3 spec, 6.1.2 Lookup by Address: Each descriptor
+              is a pair consisting of the beginning address [...],
+              followed by the _non-zero_ length of that range.  */
+           wr_error (&where, ": zero-length address range.\n");
+         else if (retval)
+           /* Skip coverage analysis if we have errors.  */
            coverage_map_add (coverage_map, address, length, &where,
                              mc_aranges);
        }