[PATCH] D39212: Check special-case-list regex before insertion.
Mitch Phillips via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 23 16:10:06 PDT 2017
hctim created this revision.
Checks that the supplied regex to SpecialCaseList::Matcher::insert(..) is non-empty.
Reported by OSS-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3688
Verified that this fixes the provided assertion failure (built with {asan, fuzzer}):
mitchp at mitchp2:~/llvm-build/git-fuzz$ ninja llvm-special-case-list-fuzzer[12/12] Linking CXX executable bin/llvm-special-case-list-fuzzer
mitchp at mitchp2:~/llvm-build/git-fuzz$ bin/llvm-special-case-list-fuzzer ~/Downloads/clusterfuzz-testcase-6748633157337088
INFO: Seed: 1697404507
INFO: Loaded 1 modules (18581 inline 8-bit counters): 18581 [0x9e9f60, 0x9ee7f5),
INFO: Loaded 1 PC tables (18581 PCs): 18581 [0x9ee7f8,0xa37148),
bin/llvm-special-case-list-fuzzer: Running 1 inputs 1 time(s) each.
Running: /usr/local/google/home/mitchp/Downloads/clusterfuzz-testcase-6748633157337088
Executed /usr/local/google/home/mitchp/Downloads/clusterfuzz-testcase-6748633157337088 in 0 ms
***
*** NOTE: fuzzing was not performed, you have only
*** executed the target code on a fixed set of inputs.
***
mitchp at mitchp2:~/llvm-build/git-fuzz$
https://reviews.llvm.org/D39212
Files:
lib/Support/SpecialCaseList.cpp
Index: lib/Support/SpecialCaseList.cpp
===================================================================
--- lib/Support/SpecialCaseList.cpp
+++ lib/Support/SpecialCaseList.cpp
@@ -28,6 +28,11 @@
bool SpecialCaseList::Matcher::insert(std::string Regexp,
std::string &REError) {
+ if (Regexp.empty()) {
+ REError = "Supplied regexp was blank";
+ return false;
+ }
+
if (Regex::isLiteralERE(Regexp)) {
Strings.insert(Regexp);
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39212.119962.patch
Type: text/x-patch
Size: 502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171023/3c127904/attachment.bin>
More information about the llvm-commits
mailing list