Fuzz with 3kb, 8kb
This commit is contained in:
@@ -18,7 +18,7 @@ extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) {
|
|||||||
/* Very simple WebSocket echo server */
|
/* Very simple WebSocket echo server */
|
||||||
app = new uWS::TemplatedApp<false>(uWS::App().ws<PerSocketData>("/*", {
|
app = new uWS::TemplatedApp<false>(uWS::App().ws<PerSocketData>("/*", {
|
||||||
/* Settings */
|
/* Settings */
|
||||||
.compression = uWS::DEDICATED_COMPRESSOR_3KB,
|
.compression = uWS::DEDICATED_COMPRESSOR_8KB,
|
||||||
/* We want this to be low so that we can hit it, yet bigger than 256 */
|
/* We want this to be low so that we can hit it, yet bigger than 256 */
|
||||||
.maxPayloadLength = 300,
|
.maxPayloadLength = 300,
|
||||||
.idleTimeout = 10,
|
.idleTimeout = 10,
|
||||||
|
|||||||
@@ -1,38 +1,38 @@
|
|||||||
/* This is a fuzz test of the permessage-deflate module */
|
/* This is a fuzz test of the permessage-deflate module */
|
||||||
|
|
||||||
#define WIN32_EXPORT
|
#define WIN32_EXPORT
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/* We test the permessage deflate module */
|
/* We test the permessage deflate module */
|
||||||
#include "../src/PerMessageDeflate.h"
|
#include "../src/PerMessageDeflate.h"
|
||||||
|
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
struct StaticData {
|
struct StaticData {
|
||||||
uWS::ZlibContext zlibContext;
|
uWS::ZlibContext zlibContext;
|
||||||
|
|
||||||
uWS::InflationStream inflationStream;
|
uWS::InflationStream inflationStream;
|
||||||
uWS::DeflationStream deflationStream = uWS::DEDICATED_COMPRESSOR_8KB;
|
uWS::DeflationStream deflationStream = uWS::DEDICATED_COMPRESSOR_3KB;
|
||||||
} staticData;
|
} staticData;
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||||
|
|
||||||
/* Why is this padded? */
|
/* Why is this padded? */
|
||||||
makeChunked(makePadded(data, size), size, [](const uint8_t *data, size_t size) {
|
makeChunked(makePadded(data, size), size, [](const uint8_t *data, size_t size) {
|
||||||
auto [inflation, valid] = staticData.inflationStream.inflate(&staticData.zlibContext, std::string_view((char *) data, size), 256);
|
auto [inflation, valid] = staticData.inflationStream.inflate(&staticData.zlibContext, std::string_view((char *) data, size), 256);
|
||||||
if (inflation.length() > 256) {
|
if (inflation.length() > 256) {
|
||||||
/* Cause ASAN to freak out */
|
/* Cause ASAN to freak out */
|
||||||
delete (int *) (void *) 1;
|
delete (int *) (void *) 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
makeChunked(makePadded(data, size), size, [](const uint8_t *data, size_t size) {
|
makeChunked(makePadded(data, size), size, [](const uint8_t *data, size_t size) {
|
||||||
/* Always reset */
|
/* Always reset */
|
||||||
staticData.deflationStream.deflate(&staticData.zlibContext, std::string_view((char *) data, size), true);
|
staticData.deflationStream.deflate(&staticData.zlibContext, std::string_view((char *) data, size), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user