Skip to content

Commit

Permalink
deps: V8: cherry-pick 422dc378a1da
Browse files Browse the repository at this point in the history
Original commit message:

    [deserialization] Remove unnecessarily limit on buffer size

    1. Now there is no serializer/deserializer-specific buffer size limit.
    2. Update AUTHORS

    Ref: #40059

    Change-Id: Iad4c6d8f68a91ef21d3c404fb7945949e69ad9e2
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3170411
    Reviewed-by: Jakob Kummerow <[email protected]>
    Reviewed-by: Clemens Backes <[email protected]>
    Commit-Queue: Jakob Kummerow <[email protected]>
    Cr-Commit-Position: refs/heads/main@{#77084}

Refs: v8/v8@422dc37

PR-URL: #40450
Fixes: #40059
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
rayw000 authored and targos committed Oct 23, 2021
1 parent 6e39e0e commit 8d16f0d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 39 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
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.12',
'v8_embedder_string': '-node.13',

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

Expand Down
27 changes: 14 additions & 13 deletions deps/v8/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ Alexis Campailla <[email protected]>
Allan Sandfeld Jensen <[email protected]>
Amos Lim <[email protected]>
Andreas Anyuru <[email protected]>
Andrew Paprocki <[email protected]>
Andrei Kashcha <[email protected]>
Andrew Paprocki <[email protected]>
Anna Henningsen <[email protected]>
Antoine du Hamel <[email protected]>
Anton Bikineev <[email protected]>
Bangfu Tao <[email protected]>
Daniel Shelton <[email protected]>
Ben Coe <[email protected]>
Ben Newman <[email protected]>
Ben Noordhuis <[email protected]>
Expand All @@ -74,18 +73,19 @@ Brice Dobry <[email protected]>
Burcu Dogan <[email protected]>
Caitlin Potter <[email protected]>
Chao Wang <[email protected]>
Craig Schlenter <[email protected]>
Charles Kerr <[email protected]>
Chengzhong Wu <[email protected]>
Choongwoo Han <[email protected]>
Chris Nardi <[email protected]>
Christopher A. Taylor <[email protected]>
Colin Ihrig <[email protected]>
Cong Zuo <[email protected]>
Craig Schlenter <[email protected]>
Daniel Andersson <[email protected]>
Daniel Bevenius <[email protected]>
Daniel Dromboski <[email protected]>
Daniel James <[email protected]>
Daniel Shelton <[email protected]>
Darshan Sen <[email protected]>
David Carlier <[email protected]>
David Manouchehri <[email protected]>
Expand Down Expand Up @@ -120,13 +120,13 @@ Ingvar Stepanyan <[email protected]>
Ioseb Dzmanashvili <[email protected]>
Isiah Meadows <[email protected]>
Jaime Bernardo <[email protected]>
Jan de Mooij <[email protected]>
James M Snell <[email protected]>
James Pike <[email protected]>
Jan Krems <[email protected]>
Jan de Mooij <[email protected]>
Janusz Majnert <[email protected]>
Jay Freeman <[email protected]>
James Pike <[email protected]>
James M Snell <[email protected]>
Javad Amiri <[email protected]>
Jay Freeman <[email protected]>
Jesper van den Ende <[email protected]>
Ji Qiu <[email protected]>
Jianghua Yang <[email protected]>
Expand All @@ -136,8 +136,8 @@ Joel Stanley <[email protected]>
Johan Bergström <[email protected]>
Jonathan Liu <[email protected]>
Julien Brianceau <[email protected]>
Junha Park <[email protected]>
JunHo Seo <[email protected]>
Junha Park <[email protected]>
Junming Huang <[email protected]>
Kang-Hao (Kenny) Lu <[email protected]>
Karl Skomski <[email protected]>
Expand Down Expand Up @@ -181,20 +181,21 @@ Oleksandr Chekhovskyi <[email protected]>
Oliver Dunk <[email protected]>
Paolo Giarrusso <[email protected]>
Patrick Gansterer <[email protected]>
Paul Lind <[email protected]>
Pavel Medvedev <[email protected]>
Peng Fei <[email protected]>
Peng Wu <[email protected]>
Peng-Yu Chen <[email protected]>
Peter Rybin <[email protected]>
Peter Varga <[email protected]>
Peter Wong <[email protected]>
Paul Lind <[email protected]>
Pavel Medvedev <[email protected]>
PhistucK <[email protected]>
Qingyan Li <[email protected]>
Qiuyi Zhang <[email protected]>
Rafal Krypa <[email protected]>
Raul Tambre <[email protected]>
Ray Glover <[email protected]>
Ray Wang <[email protected]>
Refael Ackermann <[email protected]>
Rene Rebe <[email protected]>
Reza Yazdani <[email protected]>
Expand All @@ -219,11 +220,13 @@ Stefan Penner <[email protected]>
Stephan Hartmann <[email protected]>
Stephen Belanger <[email protected]>
Sylvestre Ledru <[email protected]>
Takeshi Yoneda <[email protected]>
Taketoshi Aono <[email protected]>
Tao Liqiang <[email protected]>
Teddy Katz <[email protected]>
Thomas Young <[email protected]>
Tiancheng "Timothy" Gu <[email protected]>
Tianping Yang <[email protected]>
Timo Teräs <[email protected]>
Tobias Burnus <[email protected]>
Tobias Nießen <[email protected]>
Expand All @@ -248,13 +251,11 @@ Yi Wang <[email protected]>
Yong Wang <[email protected]>
Youfeng Hao <[email protected]>
Yu Yin <[email protected]>
Yusif Khudhur <[email protected]>
Yuri Iozzelli <[email protected]>
Yusif Khudhur <[email protected]>
Zac Hansen <[email protected]>
Zeynep Cankara <[email protected]>
Zhao Jiazhong <[email protected]>
Zheng Liu <[email protected]>
Zhongping Wang <[email protected]>
柳荣一 <[email protected]>
Tianping Yang <[email protected]>
Takeshi Yoneda <[email protected]>
26 changes: 2 additions & 24 deletions deps/v8/src/api/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3362,7 +3362,6 @@ struct ValueDeserializer::PrivateData {
: isolate(i), deserializer(i, data, delegate) {}
i::Isolate* isolate;
i::ValueDeserializer deserializer;
bool has_aborted = false;
bool supports_legacy_wire_format = false;
};

Expand All @@ -3372,16 +3371,8 @@ ValueDeserializer::ValueDeserializer(Isolate* isolate, const uint8_t* data,

ValueDeserializer::ValueDeserializer(Isolate* isolate, const uint8_t* data,
size_t size, Delegate* delegate) {
if (base::IsValueInRangeForNumericType<int>(size)) {
private_ = new PrivateData(
reinterpret_cast<i::Isolate*>(isolate),
base::Vector<const uint8_t>(data, static_cast<int>(size)), delegate);
} else {
private_ =
new PrivateData(reinterpret_cast<i::Isolate*>(isolate),
base::Vector<const uint8_t>(nullptr, 0), nullptr);
private_->has_aborted = true;
}
private_ = new PrivateData(reinterpret_cast<i::Isolate*>(isolate),
base::Vector<const uint8_t>(data, size), delegate);
}

ValueDeserializer::~ValueDeserializer() { delete private_; }
Expand All @@ -3391,15 +3382,6 @@ Maybe<bool> ValueDeserializer::ReadHeader(Local<Context> context) {
ENTER_V8_NO_SCRIPT(isolate, context, ValueDeserializer, ReadHeader,
Nothing<bool>(), i::HandleScope);

// We could have aborted during the constructor.
// If so, ReadHeader is where we report it.
if (private_->has_aborted) {
isolate->Throw(*isolate->factory()->NewError(
i::MessageTemplate::kDataCloneDeserializationError));
has_pending_exception = true;
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
}

bool read_header = false;
has_pending_exception = !private_->deserializer.ReadHeader().To(&read_header);
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
Expand All @@ -3423,12 +3405,10 @@ void ValueDeserializer::SetSupportsLegacyWireFormat(
}

uint32_t ValueDeserializer::GetWireFormatVersion() const {
CHECK(!private_->has_aborted);
return private_->deserializer.GetWireFormatVersion();
}

MaybeLocal<Value> ValueDeserializer::ReadValue(Local<Context> context) {
CHECK(!private_->has_aborted);
PREPARE_FOR_EXECUTION(context, ValueDeserializer, ReadValue, Value);
i::MaybeHandle<i::Object> result;
if (GetWireFormatVersion() > 0) {
Expand All @@ -3445,14 +3425,12 @@ MaybeLocal<Value> ValueDeserializer::ReadValue(Local<Context> context) {

void ValueDeserializer::TransferArrayBuffer(uint32_t transfer_id,
Local<ArrayBuffer> array_buffer) {
CHECK(!private_->has_aborted);
private_->deserializer.TransferArrayBuffer(transfer_id,
Utils::OpenHandle(*array_buffer));
}

void ValueDeserializer::TransferSharedArrayBuffer(
uint32_t transfer_id, Local<SharedArrayBuffer> shared_array_buffer) {
CHECK(!private_->has_aborted);
private_->deserializer.TransferArrayBuffer(
transfer_id, Utils::OpenHandle(*shared_array_buffer));
}
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/objects/value-serializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ ValueDeserializer::ValueDeserializer(Isolate* isolate,
: isolate_(isolate),
delegate_(delegate),
position_(data.begin()),
end_(data.begin() + data.length()),
end_(data.end()),
id_map_(isolate->global_handles()->Create(
ReadOnlyRoots(isolate_).empty_fixed_array())) {}

Expand Down

0 comments on commit 8d16f0d

Please sign in to comment.