mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 05:42:43 +00:00
fix: invalid json import regression (#17612)
This commit is contained in:
@@ -213,7 +213,11 @@ static EncodedJSValue assignHeadersFromUWebSockets(uWS::HttpRequest* request, JS
|
||||
auto pair = *it;
|
||||
StringView nameView = StringView(std::span { reinterpret_cast<const LChar*>(pair.first.data()), pair.first.length() });
|
||||
std::span<LChar> data;
|
||||
auto value = String::createUninitialized(pair.second.length(), data);
|
||||
auto value = String::tryCreateUninitialized(pair.second.length(), data);
|
||||
if (UNLIKELY(value.isNull())) {
|
||||
throwOutOfMemoryError(globalObject, scope);
|
||||
return JSValue::encode({});
|
||||
}
|
||||
if (pair.second.length() > 0)
|
||||
memcpy(data.data(), pair.second.data(), pair.second.length());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user