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

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 11:40:31 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL310089: [compiler-rt] Check for empty buffer in Addr2LineProcess::ReadFromSymbolizer (authored by alekseyshl).

Changed prior to commit:
  https://reviews.llvm.org/D36207?vs=109763&id=109791#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D36207

Files:
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc


Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
+++ compiler-rt/trunk/lib/sanitizer_common/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;
     }
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
+++ compiler-rt/trunk/lib/sanitizer_common/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


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


More information about the llvm-commits mailing list