Skip to content

Commit 52b7102

Browse files
committed
deps: V8: cherry-pick ea0719b8ed08
Original commit message: [snapshot] Do not defer ArrayBuffers during snapshotting ArrayBuffer instances are serialized by first re-assigning a index to the backing store field, then serializing the object, and then storing the actual backing store address again (and the same for the ArrayBufferExtension). If serialization of the object itself is deferred, the real backing store address is written into the snapshot, which cannot be processed when deserializing, leading to a crash. This fixes this by not deferring ArrayBuffer serialization and adding a DCHECK for the crash that previously occurred. Change-Id: Id9bea8268061bd0770cde7bfeb6695248978f994 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144123 Commit-Queue: Jakob Gruber <[email protected]> Reviewed-by: Dan Elphick <[email protected]> Cr-Commit-Position: refs/heads/master@{#67114} Refs: v8/v8@ea0719b
1 parent 2a70893 commit 52b7102

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

deps/v8/src/snapshot/deserializer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class V8_EXPORT_PRIVATE Deserializer : public SerializerDeserializer {
107107
}
108108

109109
std::shared_ptr<BackingStore> backing_store(size_t i) {
110+
DCHECK_LT(i, backing_stores_.size());
110111
return backing_stores_[i];
111112
}
112113

deps/v8/src/snapshot/serializer-common.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,14 @@ void SerializerDeserializer::Iterate(Isolate* isolate, RootVisitor* visitor) {
127127
}
128128

129129
bool SerializerDeserializer::CanBeDeferred(HeapObject o) {
130-
return !o.IsString() && !o.IsScript() && !o.IsJSTypedArray();
130+
// ArrayBuffer instances are serialized by first re-assigning a index
131+
// to the backing store field, then serializing the object, and then
132+
// storing the actual backing store address again (and the same for the
133+
// ArrayBufferExtension). If serialization of the object itself is deferred,
134+
// the real backing store address is written into the snapshot, which cannot
135+
// be processed when deserializing.
136+
return !o.IsString() && !o.IsScript() && !o.IsJSTypedArray() &&
137+
!o.IsJSArrayBuffer();
131138
}
132139

133140
void SerializerDeserializer::RestoreExternalReferenceRedirectors(

0 commit comments

Comments
 (0)