Commit 8e89201a authored by ivica.bogosavljevic's avatar ivica.bogosavljevic Committed by Commit bot

MIPS: Fix unaligned read and write in wasm-debug.cc

Fix crashes in two tests cctest/test-wasm-interpreter-entry/TestArgumentPassing_AllTypes and
cctest/test-wasm-interpreter-entry/TestArgumentPassing_float_double related to accessing
double value through unaligned pointer. This issue is present on those architectures
that do not support unaligned access.

TEST=cctest/test-wasm-interpreter-entry/TestArgumentPassing_AllTypes,
     cctest/test-wasm-interpreter-entry/TestArgumentPassing_float_double
BUG=

Review-Url: https://codereview.chromium.org/2705253003
Cr-Commit-Position: refs/heads/master@{#43387}
parent 24eed5d2
......@@ -89,7 +89,7 @@ class InterpreterHandle {
#define CASE_ARG_TYPE(type, ctype) \
case type: \
DCHECK_EQ(param_size, sizeof(ctype)); \
wasm_args[i] = WasmVal(*reinterpret_cast<ctype*>(arg_buf_ptr)); \
wasm_args[i] = WasmVal(ReadUnalignedValue<ctype>(arg_buf_ptr)); \
break;
switch (sig->GetParam(i)) {
CASE_ARG_TYPE(kWasmI32, uint32_t)
......@@ -143,7 +143,7 @@ class InterpreterHandle {
#define CASE_RET_TYPE(type, ctype) \
case type: \
DCHECK_EQ(1 << ElementSizeLog2Of(sig->GetReturn(0)), sizeof(ctype)); \
*reinterpret_cast<ctype*>(arg_buffer) = ret_val.to<ctype>(); \
WriteUnalignedValue<ctype>(arg_buffer, ret_val.to<ctype>()); \
break;
switch (sig->GetReturn(0)) {
CASE_RET_TYPE(kWasmI32, uint32_t)
......
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