[PATCH] D53509: Fix llvm-strings crash for negative char values
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 23 06:17:38 PDT 2018
jhenderson updated this revision to Diff 170620.
jhenderson added a comment.
Add quotes to echo string in test.
Repository:
rL LLVM
https://reviews.llvm.org/D53509
Files:
test/tools/llvm-strings/negative-char.test
tools/llvm-strings/llvm-strings.cpp
Index: tools/llvm-strings/llvm-strings.cpp
===================================================================
--- tools/llvm-strings/llvm-strings.cpp
+++ tools/llvm-strings/llvm-strings.cpp
@@ -80,7 +80,7 @@
const char *B = Contents.begin();
const char *P = nullptr, *E = nullptr, *S = nullptr;
for (P = Contents.begin(), E = Contents.end(); P < E; ++P) {
- if (std::isgraph(*P) || std::isblank(*P)) {
+ if (isPrint(*P) || *P == '\t') {
if (S == nullptr)
S = P;
} else if (S) {
Index: test/tools/llvm-strings/negative-char.test
===================================================================
--- test/tools/llvm-strings/negative-char.test
+++ test/tools/llvm-strings/negative-char.test
@@ -0,0 +1,3 @@
+# RUN: echo -e "z\0\x80\0a\0" | llvm-strings --bytes 1 - | FileCheck %s
+# CHECK: z{{$}}
+# CHECK-NEXT: {{^}} a
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53509.170620.patch
Type: text/x-patch
Size: 856 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181023/36362ccb/attachment.bin>
More information about the llvm-commits
mailing list