Add first de-fuzzer files

This commit is contained in:
jzmaddock
2017-02-20 14:55:55 +00:00
parent 94cd9e582b
commit 559f24d6d0
2 changed files with 214 additions and 0 deletions

19
test/de_fuzz/narrow.cpp Normal file
View File

@ -0,0 +1,19 @@
#include <boost/regex.hpp>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
{
if(Size < 2)
return 0;
try{
size_t len = (Data[1] << 8) | Data[0];
std::string str((char*)(Data + 2), len);
std::string text((char*)(Data + len), Size - len);
boost::regex e(str);
boost::smatch what;
regex_search(text, what, e, boost::match_default|boost::match_partial);
}
catch(const std::exception&){}
return 0;
}