node icon indicating copy to clipboard operation
node copied to clipboard

src: zero-initialize data that are copied into the snapshot

Open joyeecheung opened this issue 8 months ago • 12 comments

This reverts one commit from https://github.com/nodejs/node/pull/50983 because I found a better & simpler approach to prevent the padding from affecting snapshot reproducibility (in the second commit).

Revert "src: make sure that memcpy-ed structs in snapshot have no padding"

This reverts commit 4e58cde589dfd980c8976b158853a331142e1e4b.

src: zero-initialize data that are copied into the snapshot

To prevent padding from making the snapshot unreproducible, zero-initialize the data that are copied into the snapshot so that the padding copied are all zeros. This is better than enlarging the enums to align the fields since it doesn't make the snapshot bigger than necessary, and it removes the need of using static assertions to ensure alignment.

Refs: https://github.com/nodejs/node/pull/50983

joyeecheung avatar Jun 23 '24 21:06 joyeecheung