Skip to content

Commit

Permalink
fixup! src: zero-initialize data that are copied into the snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
joyeecheung committed Jun 24, 2024
1 parent af91d7d commit e99dc36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/node_snapshotable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1415,8 +1415,8 @@ StartupData SerializeNodeContextInternalFields(Local<Object> holder,
// To serialize the type field, save data in a EmbedderTypeInfo.
if (index == BaseObject::kEmbedderType) {
int size = sizeof(EmbedderTypeInfo);
char* data = new char[size];
memset(data, 0, size); // Make the padding reproducible.
// Zero-initialize to make the padding reproducible.
char* data = new char[size]();
// We need to use placement new because V8 calls delete[] on the returned
// data.
// TODO(joyeecheung): support cppgc objects.
Expand Down

0 comments on commit e99dc36

Please sign in to comment.