Fix fuzzing
This commit is contained in:
+2
-2
@@ -12,13 +12,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||||||
|
|
||||||
/* Pad the fuzz */
|
/* Pad the fuzz */
|
||||||
uWS::HttpParser httpParser;
|
uWS::HttpParser httpParser;
|
||||||
memcpy(padded + 32, data, size);
|
memcpy(padded, data, size);
|
||||||
|
|
||||||
/* User data */
|
/* User data */
|
||||||
void *user = (void *) 13;
|
void *user = (void *) 13;
|
||||||
|
|
||||||
/* Parse it */
|
/* Parse it */
|
||||||
httpParser.consumePostPadded(padded + 32, size, user, [](void *s, uWS::HttpRequest *httpRequest) -> void * {
|
httpParser.consumePostPadded(padded, size, user, [](void *s, uWS::HttpRequest *httpRequest) -> void * {
|
||||||
|
|
||||||
/* todo: Route this via router */
|
/* todo: Route this via router */
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -92,7 +92,7 @@ class HttpParser {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string fallback;
|
std::string fallback;
|
||||||
int remainingStreamingBytes = 0;
|
unsigned int remainingStreamingBytes = 0;
|
||||||
|
|
||||||
const size_t MAX_FALLBACK_SIZE = 1024 * 4;
|
const size_t MAX_FALLBACK_SIZE = 1024 * 4;
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ private:
|
|||||||
remainingStreamingBytes = toUnsignedInteger(contentLengthString);
|
remainingStreamingBytes = toUnsignedInteger(contentLengthString);
|
||||||
|
|
||||||
if (!CONSUME_MINIMALLY) {
|
if (!CONSUME_MINIMALLY) {
|
||||||
int emittable = std::min(remainingStreamingBytes, length);
|
unsigned int emittable = std::min<unsigned int>(remainingStreamingBytes, length);
|
||||||
dataHandler(user, std::string_view(data, emittable), emittable == remainingStreamingBytes);
|
dataHandler(user, std::string_view(data, emittable), emittable == remainingStreamingBytes);
|
||||||
remainingStreamingBytes -= emittable;
|
remainingStreamingBytes -= emittable;
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule uSockets updated: d67d75db2c...215d079bb1
Reference in New Issue
Block a user