]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Don't let unterminated strings in .debug_str to high-level
authorPetr Machata <pmachata@redhat.com>
Tue, 8 Mar 2011 22:24:53 +0000 (23:24 +0100)
committerPetr Machata <pmachata@redhat.com>
Tue, 8 Mar 2011 22:24:53 +0000 (23:24 +0100)
dwarflint/check_debug_info.cc

index ce245911d83a98f5f403b29f508cbcb3a13f2427..7b936cb91c117dbeb682df9d4b8359e2fc2a4ecb 100644 (file)
@@ -398,6 +398,7 @@ namespace
     struct coverage *strings_coverage;
     struct coverage *pc_coverage;
     bool *need_rangesp;
+    int *retval_p;
   };
 
   typedef void (*value_check_cb_t) (uint64_t addr,
@@ -451,9 +452,12 @@ namespace
        while (strp < data_end && *strp != 0)
          ++strp;
        if (strp == data_end)
-         wr_error (*ctx->where)
-           << "string at .debug_str: " << pri::hex (addr)
-           << " is not zero-terminated." << std::endl;
+         {
+           wr_error (*ctx->where)
+             << "string at .debug_str: " << pri::hex (addr)
+             << " is not zero-terminated." << std::endl;
+           *ctx->retval_p = -2;
+         }
 
        if (ctx->strings_coverage != NULL)
          ctx->strings_coverage->add (addr, strp - startp + 1);
@@ -532,7 +536,8 @@ namespace
       local_die_refs,
       strings, strings_coverage,
       pc_coverage,
-      need_rangesp
+      need_rangesp,
+      &retval
     };
 
     while (!read_ctx_eof (ctx))