Skip to content

Commit d2ee676

Browse files
danbevBethGriggs
authored andcommittedDec 15, 2020
deps: cherry-pick 9a49b22 from V8 upstream
Original commit message: Fix alloc/dealloc size mismatch for v8::BackingStore On newer compilers the {operator delete} with explicit {size_t} argument would be instantiated for {v8::BackingStore} and used in the destructor of {std::unique_ptr<v8::BackingStore>}. The {size_t} argument is wrong though, since the pointer actually points to a {v8::internal::BackingStore} object. The solution is to explicitly provide a {operator delete}, preventing an implicitly generated {size_t} operator. Bug:v8:11081 Change-Id: Iee0aa47a67f0e41000bea628942f7e3d70198b83 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2506712 Commit-Queue: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#70916} PR-URL: #35939 Fixes: #35669 Refs: v8/v8@9a49b22 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
1 parent c455b84 commit d2ee676

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎deps/v8/include/v8.h

+7
Original file line numberDiff line numberDiff line change
@@ -4975,6 +4975,13 @@ class V8_EXPORT BackingStore : public v8::internal::BackingStoreBase {
49754975
*/
49764976
bool IsShared() const;
49774977

4978+
/**
4979+
* Prevent implicit instantiation of operator delete with size_t argument.
4980+
* The size_t argument would be incorrect because ptr points to the
4981+
* internal BackingStore object.
4982+
*/
4983+
void operator delete(void* ptr) { ::operator delete(ptr); }
4984+
49784985
/**
49794986
* Wrapper around ArrayBuffer::Allocator::Reallocate that preserves IsShared.
49804987
* Assumes that the backing_store was allocated by the ArrayBuffer allocator

0 commit comments

Comments
 (0)
Please sign in to comment.