Commit 8ae4143a authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[wasm] Fix alloc/dealloc size mismatch for WasmInstructionBuffer

On newer compilers the {operator delete} with explicit {size_t}
argument would be instantiated for {WasmInstructionBuffer} and used
in the destructor of {std::unique_ptr<WasmInstructionBuffer>}. The
{size_t} argument is wrong though, since the pointer actually points
to a {WasmInstructionBufferImpl} object.
The solution is to explicitly provide a {operator delete}, preventing
an implicitly generated {size_t} operator.

R=clemensh@chromium.org

Change-Id: I2cc22078d03a523121309bae94f5b612cb98e112
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1702613Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62737}
parent ee45ce9c
......@@ -35,6 +35,10 @@ class WasmInstructionBuffer final {
static std::unique_ptr<WasmInstructionBuffer> New();
// 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:
WasmInstructionBuffer() = delete;
DISALLOW_COPY_AND_ASSIGN(WasmInstructionBuffer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment