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 */
|
||||
httpParser.consumePostPadded((char *) data, size, user, [](void *s, uWS::HttpRequest *httpRequest) -> void * {
|
||||
|
||||
/* todo: Route this via router */
|
||||
|
||||
readBytes(httpRequest->getHeader(httpRequest->getUrl()));
|
||||
readBytes(httpRequest->getMethod());
|
||||
readBytes(httpRequest->getQuery());
|
||||
|
||||
+5
-1
@@ -29,6 +29,9 @@
|
||||
|
||||
namespace uWS {
|
||||
|
||||
/* We require at least this much post padding */
|
||||
static const int MINIMUM_HTTP_POST_PADDING = 32;
|
||||
|
||||
class HttpRequest {
|
||||
|
||||
friend class HttpParser;
|
||||
@@ -248,7 +251,8 @@ public:
|
||||
|
||||
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);
|
||||
|
||||
// break here on break
|
||||
|
||||
Reference in New Issue
Block a user