Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Source/JavaScriptCore/runtime/CachedTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,12 @@ class Encoder {
}

size_t size = m_baseOffset + m_currentPage->size();
auto buffer = MallocSpan<uint8_t, VMMalloc>::malloc(size);
// The payload is the encoder's largest allocation and the cache is optional: report ENOMEM instead of crashing.
auto buffer = MallocSpan<uint8_t, VMMalloc>::tryMalloc(size);
if (!buffer) {
error = BytecodeCacheError::StandardError(ENOMEM);
return nullptr;
}
auto bufferSpan = buffer.mutableSpan();
for (const auto& page : m_pages)
memcpySpan(consumeSpan(bufferSpan, page.size()), page.span());
Expand Down
Loading