Guarantee SSO is not applicable to fallback buffer
This commit is contained in:
@@ -57,8 +57,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||||||
/* Parse it */
|
/* Parse it */
|
||||||
httpParser.consumePostPadded((char *) data, size, user, [](void *s, uWS::HttpRequest *httpRequest) -> void * {
|
httpParser.consumePostPadded((char *) data, size, user, [](void *s, uWS::HttpRequest *httpRequest) -> void * {
|
||||||
|
|
||||||
/* todo: Route this via router */
|
|
||||||
|
|
||||||
readBytes(httpRequest->getHeader(httpRequest->getUrl()));
|
readBytes(httpRequest->getHeader(httpRequest->getUrl()));
|
||||||
readBytes(httpRequest->getMethod());
|
readBytes(httpRequest->getMethod());
|
||||||
readBytes(httpRequest->getQuery());
|
readBytes(httpRequest->getQuery());
|
||||||
|
|||||||
+5
-1
@@ -29,6 +29,9 @@
|
|||||||
|
|
||||||
namespace uWS {
|
namespace uWS {
|
||||||
|
|
||||||
|
/* We require at least this much post padding */
|
||||||
|
static const int MINIMUM_HTTP_POST_PADDING = 32;
|
||||||
|
|
||||||
class HttpRequest {
|
class HttpRequest {
|
||||||
|
|
||||||
friend class HttpParser;
|
friend class HttpParser;
|
||||||
@@ -248,7 +251,8 @@ public:
|
|||||||
|
|
||||||
int maxCopyDistance = std::min(MAX_FALLBACK_SIZE - fallback.length(), (size_t) length);
|
int maxCopyDistance = std::min(MAX_FALLBACK_SIZE - fallback.length(), (size_t) length);
|
||||||
|
|
||||||
fallback.reserve(fallback.length() + maxCopyDistance + 32); // todo: padding should be same as libus
|
/* We don't want fallback to be short string optimized, since we want to move it */
|
||||||
|
fallback.reserve(fallback.length() + maxCopyDistance + std::max<int>(MINIMUM_HTTP_POST_PADDING, sizeof(std::string)));
|
||||||
fallback.append(data, maxCopyDistance);
|
fallback.append(data, maxCopyDistance);
|
||||||
|
|
||||||
// break here on break
|
// break here on break
|
||||||
|
|||||||
Reference in New Issue
Block a user