]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Check that base address is set when validating loc or ranges
authorPetr Machata <pmachata@redhat.com>
Wed, 28 Jan 2009 15:45:46 +0000 (16:45 +0100)
committerPetr Machata <pmachata@redhat.com>
Wed, 28 Jan 2009 15:45:46 +0000 (16:45 +0100)
src/dwarflint.c

index ff41e012a8f1994d83ee8a3f1db45b97f941e643..42fe1cd2b0f9f28504c2928eef4e00b2f0257c7a 100644 (file)
@@ -722,7 +722,7 @@ static const char *where_fmt (struct where *wh, char *ptr)
   char *addr##N##s;                                                    \
   if (wh->addr##N == (uint64_t)-1)                                     \
     addr##N##s = NULL;                                                 \
-  else if (x_asprintf (&addr##N##s, inf->addr##N##f, wh->addr##N) < 0) \
+  else if (x_asprintf (&addr##N##s, inf->addr##N##f, wh->addr##N) < 0) \
     addr##N##s = "(fmt error)"
 
   SETUP_ADDR (1);
@@ -2200,6 +2200,12 @@ check_loc_or_range_ref (struct read_ctx *ctx,
 
       if (!done && begin_addr != escape)
        {
+         if (base == (uint64_t)-1)
+           {
+             wr_error (&where, ": address range with no base address set.\n");
+             base = (uint64_t)-2; /* Only report once.  */
+           }
+
          if (end_addr < begin_addr)
            wr_message (cat | mc_error, &where,
                        ": has negative range 0x%" PRIx64 "..0x%" PRIx64 ".\n",