[PATCH] D36207: [compiler-rt] Check for empty buffer in Addr2LineProcess::ReadFromSymbolizer

David Lam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 09:34:07 PDT 2017


david-y-lam updated this revision to Diff 109763.
david-y-lam marked an inline comment as done.
david-y-lam added a comment.

amend comment. land-ready. could someone commit this for me? I don't have commit access.


https://reviews.llvm.org/D36207

Files:
  sanitizer_symbolizer_libcdep.cc
  sanitizer_symbolizer_posix_libcdep.cc


Index: sanitizer_symbolizer_posix_libcdep.cc
===================================================================
--- sanitizer_symbolizer_posix_libcdep.cc
+++ sanitizer_symbolizer_posix_libcdep.cc
@@ -272,6 +272,10 @@
   bool ReadFromSymbolizer(char *buffer, uptr max_length) override {
     if (!SymbolizerProcess::ReadFromSymbolizer(buffer, max_length))
       return false;
+    // The returned buffer is empty when output is valid, but exceeds
+    // max_length.
+    if (*buffer == '\0')
+      return true;
     // We should cut out output_terminator_ at the end of given buffer,
     // appended by addr2line to mark the end of its meaningful output.
     // We cannot scan buffer from it's beginning, because it is legal for it
Index: sanitizer_symbolizer_libcdep.cc
===================================================================
--- sanitizer_symbolizer_libcdep.cc
+++ sanitizer_symbolizer_libcdep.cc
@@ -454,7 +454,7 @@
     if (ReachedEndOfOutput(buffer, read_len))
       break;
     if (read_len + 1 == max_length) {
-      Report("WARNING: Symbolizer buffer too small");
+      Report("WARNING: Symbolizer buffer too small\n");
       read_len = 0;
       break;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36207.109763.patch
Type: text/x-patch
Size: 1190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170804/2056b3d4/attachment.bin>


More information about the llvm-commits mailing list