about summary refs log tree commit diff
path: root/third_party/abseil_cpp/absl/debugging/symbolize_elf.inc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-06-17T13·53+0100
committerVincent Ambo <tazjin@google.com>2020-06-17T13·53+0100
commit543379ce4572a4015c62812f93acb02938caece1 (patch)
tree797b0cbcc4795bbc73d9d5b2913e06156fa8614a /third_party/abseil_cpp/absl/debugging/symbolize_elf.inc
parentc224a738e7524fd0b6c8bed134f43b307bdbc9e8 (diff)
parent8f2828c4b4ce502d242eca80a80269448857f4a6 (diff)
merge(3p/abseil_cpp): Merge upstream at 'ccdbb5941' r/1011
Change-Id: I6e85fc7b5f76bba1f1eef15e600a8acb64e97ef5
Diffstat (limited to 'third_party/abseil_cpp/absl/debugging/symbolize_elf.inc')
-rw-r--r--third_party/abseil_cpp/absl/debugging/symbolize_elf.inc8
1 files changed, 4 insertions, 4 deletions
diff --git a/third_party/abseil_cpp/absl/debugging/symbolize_elf.inc b/third_party/abseil_cpp/absl/debugging/symbolize_elf.inc
index ec86f9a933..c05424e05b 100644
--- a/third_party/abseil_cpp/absl/debugging/symbolize_elf.inc
+++ b/third_party/abseil_cpp/absl/debugging/symbolize_elf.inc
@@ -74,6 +74,7 @@
 #include "absl/base/port.h"
 #include "absl/debugging/internal/demangle.h"
 #include "absl/debugging/internal/vdso_support.h"
+#include "absl/strings/string_view.h"
 
 namespace absl {
 ABSL_NAMESPACE_BEGIN
@@ -498,7 +499,7 @@ static ABSL_ATTRIBUTE_NOINLINE bool GetSectionHeaderByType(
 const int kMaxSectionNameLen = 64;
 
 bool ForEachSection(int fd,
-                    const std::function<bool(const std::string &name,
+                    const std::function<bool(absl::string_view name,
                                              const ElfW(Shdr) &)> &callback) {
   ElfW(Ehdr) elf_header;
   if (!ReadFromOffsetExact(fd, &elf_header, sizeof(elf_header), 0)) {
@@ -520,7 +521,7 @@ bool ForEachSection(int fd,
       return false;
     }
     off_t name_offset = shstrtab.sh_offset + out.sh_name;
-    char header_name[kMaxSectionNameLen + 1];
+    char header_name[kMaxSectionNameLen];
     ssize_t n_read =
         ReadFromOffset(fd, &header_name, kMaxSectionNameLen, name_offset);
     if (n_read == -1) {
@@ -529,9 +530,8 @@ bool ForEachSection(int fd,
       // Long read?
       return false;
     }
-    header_name[n_read] = '\0';
 
-    std::string name(header_name);
+    absl::string_view name(header_name, strnlen(header_name, n_read));
     if (!callback(name, out)) {
       break;
     }