[PATCH] D46344: [sanitizer] Fix Fuchsia ReadBinaryName not to crash when uninitialized
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 2 11:12:28 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL331382: [sanitizer] Fix Fuchsia ReadBinaryName not to crash when uninitialized (authored by phosek, committed by ).
Herald added a subscriber: delcypher.
Changed prior to commit:
https://reviews.llvm.org/D46344?vs=144821&id=144906#toc
Repository:
rL LLVM
https://reviews.llvm.org/D46344
Files:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc
@@ -431,8 +431,10 @@
}
uptr ReadBinaryName(/*out*/ char *buf, uptr buf_len) {
- const char *argv0 = StoredArgv[0];
- if (!argv0) argv0 = "<UNKNOWN>";
+ const char *argv0 = "<UNKNOWN>";
+ if (StoredArgv && StoredArgv[0]) {
+ argv0 = StoredArgv[0];
+ }
internal_strncpy(buf, argv0, buf_len);
return internal_strlen(buf);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46344.144906.patch
Type: text/x-patch
Size: 603 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180502/dcd263ed/attachment.bin>
More information about the llvm-commits
mailing list