[PATCH] D27574: [sanitizer] Add workaround for empty strings

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 08:58:47 PST 2016


vitalybuka created this revision.
vitalybuka added a reviewer: eugenis.
vitalybuka added a subscriber: llvm-commits.
Herald added a subscriber: kubabrecka.

I see crashes on this check when some reports are being generated.


https://reviews.llvm.org/D27574

Files:
  lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc


Index: lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
===================================================================
--- lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
+++ lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
@@ -244,11 +244,13 @@
   CHECK(file_line_info);
   // Parse the last :<int>, which must be there.
   char *last_colon = internal_strrchr(file_line_info, ':');
-  CHECK(last_colon);
-  int line_or_column = internal_atoll(last_colon + 1);
-  // Truncate the string at the last colon and find the next-to-last colon.
-  *last_colon = '\0';
-  last_colon = internal_strrchr(file_line_info, ':');
+  int line_or_column = 0;
+  if (last_colon) {
+    line_or_column = internal_atoll(last_colon + 1);
+    // Truncate the string at the last colon and find the next-to-last colon.
+    *last_colon = '\0';
+    last_colon = internal_strrchr(file_line_info, ':');
+  }
   if (last_colon && IsDigit(last_colon[1])) {
     // If the second-to-last colon is followed by a digit, it must be the line
     // number, and the previous parsed number was a column.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27574.80762.patch
Type: text/x-patch
Size: 1090 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161208/744fe514/attachment.bin>


More information about the llvm-commits mailing list