Improve fuzzing coverage
This commit is contained in:
+6
-1
@@ -97,12 +97,17 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
}
|
||||
|
||||
/* Parse it */
|
||||
httpParser.consumePostPadded((char *) data, size, user, reserved, [](void *s, uWS::HttpRequest *httpRequest) -> void * {
|
||||
httpParser.consumePostPadded((char *) data, size, user, reserved, [reserved](void *s, uWS::HttpRequest *httpRequest) -> void * {
|
||||
|
||||
readBytes(httpRequest->getHeader(httpRequest->getUrl()));
|
||||
readBytes(httpRequest->getMethod());
|
||||
readBytes(httpRequest->getQuery());
|
||||
|
||||
#ifdef UWS_WITH_PROXY
|
||||
auto *pp = (uWS::ProxyParser *) reserved;
|
||||
readBytes(pp->getSourceAddress());
|
||||
#endif
|
||||
|
||||
/* Route the method and URL in two passes */
|
||||
staticData.router.getUserData() = {};
|
||||
if (!staticData.router.route(httpRequest->getMethod(), httpRequest->getUrl())) {
|
||||
|
||||
+2
-11
@@ -70,15 +70,6 @@ private:
|
||||
Super::write(buf, length);
|
||||
}
|
||||
|
||||
/* Write an unsigned 32-bit integer */
|
||||
void writeUnsigned(unsigned int value) {
|
||||
char buf[10];
|
||||
int length = utils::u32toa(value, buf);
|
||||
|
||||
/* For now we do this copy */
|
||||
Super::write(buf, length);
|
||||
}
|
||||
|
||||
/* When we are done with a response we mark it like so */
|
||||
void markDone(HttpResponseData<SSL> *httpResponseData) {
|
||||
httpResponseData->onAborted = nullptr;
|
||||
@@ -376,10 +367,10 @@ public:
|
||||
}
|
||||
|
||||
/* Write an HTTP header with unsigned int value */
|
||||
HttpResponse *writeHeader(std::string_view key, unsigned int value) {
|
||||
HttpResponse *writeHeader(std::string_view key, uint64_t value) {
|
||||
Super::write(key.data(), (int) key.length());
|
||||
Super::write(": ", 2);
|
||||
writeUnsigned(value);
|
||||
writeUnsigned64(value);
|
||||
Super::write("\r\n", 2);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -43,23 +43,6 @@ inline int u32toaHex(uint32_t value, char *dst) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline int u32toa(uint32_t value, char *dst) {
|
||||
char temp[10];
|
||||
char *p = temp;
|
||||
do {
|
||||
*p++ = (char) ((value % 10) + '0');
|
||||
value /= 10;
|
||||
} while (value > 0);
|
||||
|
||||
int ret = (int) (p - temp);
|
||||
|
||||
do {
|
||||
*dst++ = *--p;
|
||||
} while (p != temp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline int u64toa(uint64_t value, char *dst) {
|
||||
char temp[20];
|
||||
char *p = temp;
|
||||
|
||||
Reference in New Issue
Block a user