Skip to content

Commit ea0d6a0

Browse files
committed
Also fuzz handshakes
1 parent 9fb3580 commit ea0d6a0

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

fuzzing/Handshake.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* This is a fuzz test of the websocket handshake generator */
2+
3+
#define WIN32_EXPORT
4+
5+
#include <cstdio>
6+
#include <string>
7+
8+
/* We test the websocket handshake generator */
9+
#include "../src/libwshandshake.hpp"
10+
11+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
12+
13+
char output[28];
14+
if (size >= 24) {
15+
WebSocketHandshake::generate((char *) data, output);
16+
}
17+
18+
return 0;
19+
}
20+

fuzzing/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ default:
22
clang++ -std=c++17 -fsanitize=address,fuzzer -O3 WebSocket.cpp -o WebSocket
33
clang++ -std=c++17 -fsanitize=address,fuzzer -O3 Http.cpp -o Http
44
clang++ -std=c++17 -fsanitize=address,fuzzer -O3 Extensions.cpp -o Extensions
5+
clang++ -std=c++17 -fsanitize=address,fuzzer -O3 Handshake.cpp -o Handshake

0 commit comments

Comments
 (0)