Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: V8: cherry-pick 501482cbc704 #38121

Merged
merged 2 commits into from Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.8',
'v8_embedder_string': '-node.9',

##### V8 defaults for Node.js #####

Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/objects/value-serializer.cc
Expand Up @@ -1190,7 +1190,8 @@ Maybe<T> ValueDeserializer::ReadZigZag() {

Maybe<double> ValueDeserializer::ReadDouble() {
// Warning: this uses host endianness.
if (position_ > end_ - sizeof(double)) return Nothing<double>();
if (sizeof(double) > static_cast<unsigned>(end_ - position_))
return Nothing<double>();
double value;
base::Memcpy(&value, position_, sizeof(double));
position_ += sizeof(double);
Expand Down
7 changes: 7 additions & 0 deletions test/parallel/test-v8-serdes.js
Expand Up @@ -236,3 +236,10 @@ const hostObject = new (internalBinding('js_stream').JSStream)();
/^TypeError: buffer must be a TypedArray or a DataView$/,
);
}

{
// Regression test for https://github.com/nodejs/node/issues/37978
assert.throws(() => {
new v8.Deserializer(new v8.Serializer().releaseBuffer()).readDouble();
}, /ReadDouble\(\) failed/);
}