forked from boostorg/regex
Add first de-fuzzer files
This commit is contained in:
19
test/de_fuzz/narrow.cpp
Normal file
19
test/de_fuzz/narrow.cpp
Normal 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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user