From 22b8fe3b7b0e933fe94cf09728cac9f533856096 Mon Sep 17 00:00:00 2001 From: Clemens Hammacher Date: Mon, 27 May 2019 16:51:44 +0200 Subject: [PATCH] [wasm] Fix alloc/dealloc size mismatch On newer compilers the {operator delete} with explicit {size_t} argument would be instantiated for {CompilationState} and used in the destructor of {std::unique_ptr}. The {size_t} argument is wrong though, since the pointer actually points to a {CompilationStateImpl} object. Hence avoid this operator from being created by explicitly providing an {operator delete}. R=ulan@chromium.org Change-Id: I54fef07179b3106f3154ddd43df040fe8e3cdde8 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1631426 Reviewed-by: Ulan Degenbaev Commit-Queue: Clemens Hammacher Cr-Commit-Position: refs/heads/master@{#61859} --- src/wasm/compilation-environment.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wasm/compilation-environment.h b/src/wasm/compilation-environment.h index 59a65651ce..07bc8f57bc 100644 --- a/src/wasm/compilation-environment.h +++ b/src/wasm/compilation-environment.h @@ -122,6 +122,10 @@ class CompilationState { V8_EXPORT_PRIVATE bool baseline_compilation_finished() const; V8_EXPORT_PRIVATE bool top_tier_compilation_finished() const; + // Override {operator delete} to avoid implicit instantiation of {operator + // delete} with {size_t} argument. The {size_t} argument would be incorrect. + void operator delete(void* ptr) { ::operator delete(ptr); } + private: // NativeModule is allowed to call the static {New} method. friend class NativeModule;