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
5 changes: 4 additions & 1 deletion src/node_snapshotable.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ struct InternalFieldInfoBase {
template <std::derived_from<InternalFieldInfoBase> T>
static T* New(EmbedderObjectType type) {
void* buf = ::operator new[](sizeof(T));
memset(buf, 0, sizeof(T)); // Make the padding reproducible.
T* result = new (buf) T;
// Zero the padding to make the bytes handed to V8 reproducible. Must come
// after the placement new, or -flifetime-dse drops it as a dead store.
// https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-fno-lifetime-dse
memset(static_cast<void*>(result), 0, sizeof(T));
result->type = type;
result->length = sizeof(T);
return result;
Expand Down
Loading