Skip to content

Commit

Permalink
[deserialization] Remove unnecessarily limit on buffer size
Browse files Browse the repository at this point in the history
1. Now there is no serializer/deserializer-specific buffer size limit.
2. Update AUTHORS

Ref: nodejs/node#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}
  • Loading branch information
rayw000 authored and V8 LUCI CQ committed Sep 27, 2021
1 parent bd87901 commit 422dc37
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 38 deletions.
27 changes: 14 additions & 13 deletions 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 src/api/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3369,7 +3369,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 @@ -3379,16 +3378,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 @@ -3398,15 +3389,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 @@ -3430,12 +3412,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 @@ -3452,14 +3432,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 src/objects/value-serializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,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 422dc37

Please sign in to comment.