Add fuzz test for QueryParser

This commit is contained in:
Alex Hultman
2020-09-28 12:30:12 +02:00
parent a1445d9459
commit d9e2480590
3 changed files with 21 additions and 0 deletions
+1
View File
@@ -22,6 +22,7 @@ oss-fuzz:
# Link against object files
$(CXX) $(CXXFLAGS) $(WRAPPED_SYSCALLS) -std=c++17 -O2 -DUWS_NO_ZLIB -I../src -I../uSockets/src EpollHelloWorld.cpp -o $(OUT)/EpollHelloWorld $(LIB_FUZZING_ENGINE) *.o
# "Unit tests"
$(CXX) $(CXXFLAGS) -std=c++17 -O3 QueryParser.cpp -o $(OUT)/QueryParser $(LIB_FUZZING_ENGINE)
$(CXX) $(CXXFLAGS) -std=c++17 -O3 WebSocket.cpp -o $(OUT)/WebSocket $(LIB_FUZZING_ENGINE)
$(CXX) $(CXXFLAGS) -std=c++17 -O3 Http.cpp -o $(OUT)/Http $(LIB_FUZZING_ENGINE)
$(CXX) $(CXXFLAGS) -DUWS_WITH_PROXY -std=c++17 -O3 Http.cpp -o $(OUT)/HttpWithProxy $(LIB_FUZZING_ENGINE)
+13
View File
@@ -0,0 +1,13 @@
#include "../src/QueryParser.h"
#include <string>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
std::string modifiableInput((char *) data, size);
uWS::getDecodedQueryValue("", modifiableInput);
uWS::getDecodedQueryValue("hello", modifiableInput);
return 0;
}
+7
View File
@@ -0,0 +1,7 @@
"?"
"%FF"
"&"
"+"
"hello"
"="