[PATCH] D42057: [FileCheck] - Fix possible buffer out of bounds access when parsing --check-prefix.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 16 00:10:59 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL322536: [FileCheck] - Fix possible buffer out of bounds access when parsing --checkā¦ (authored by grimar, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D42057?vs=129867&id=129919#toc
Repository:
rL LLVM
https://reviews.llvm.org/D42057
Files:
llvm/trunk/test/FileCheck/check-empty2.txt
llvm/trunk/utils/FileCheck/FileCheck.cpp
Index: llvm/trunk/test/FileCheck/check-empty2.txt
===================================================================
--- llvm/trunk/test/FileCheck/check-empty2.txt
+++ llvm/trunk/test/FileCheck/check-empty2.txt
@@ -0,0 +1,4 @@
+; Check that tool does not crash when there is no any data
+; in file after -check-prefix=PREFIX option.
+
+; RUN: not FileCheck -input-file %s %s -check-prefix=A
\ No newline at end of file
Index: llvm/trunk/utils/FileCheck/FileCheck.cpp
===================================================================
--- llvm/trunk/utils/FileCheck/FileCheck.cpp
+++ llvm/trunk/utils/FileCheck/FileCheck.cpp
@@ -718,6 +718,9 @@
}
static Check::CheckType FindCheckType(StringRef Buffer, StringRef Prefix) {
+ if (Buffer.size() <= Prefix.size())
+ return Check::CheckNone;
+
char NextChar = Buffer[Prefix.size()];
// Verify that the : is present after the prefix.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42057.129919.patch
Type: text/x-patch
Size: 896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180116/d8f1a370/attachment.bin>
More information about the llvm-commits
mailing list