[wasm] Fix msan issue in test

The convert operation only write an output value if the conversion
succeeded. Thus, we always initialize the buffer before calling the
conversion function.

R=ahaas@chromium.org

Change-Id: Ide230a1e608205f9067349db08adde6a90b31d6f
Reviewed-on: https://chromium-review.googlesource.com/1021377
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52703}
This commit is contained in:
Clemens Hammacher 2018-04-20 11:08:22 +02:00 committed by Commit Bot
parent 8d2d0513c3
commit d9015ef8bc

View File

@ -86,7 +86,8 @@ template <typename InType, typename OutType, typename Iterable>
void TestExternalReference_ConvertOp(
BufferedRawMachineAssemblerTester<int32_t>* m, ExternalReference ref,
void (*wrapper)(Address), Iterable inputs) {
uint8_t buffer[std::max(sizeof(InType), sizeof(OutType))];
constexpr size_t kBufferSize = Max(sizeof(InType), sizeof(OutType));
uint8_t buffer[kBufferSize] = {0};
Address buffer_addr = reinterpret_cast<Address>(buffer);
Node* function = m->ExternalConstant(ref);
@ -112,7 +113,8 @@ template <typename InType, typename OutType, typename Iterable>
void TestExternalReference_ConvertOpWithOutputAndReturn(
BufferedRawMachineAssemblerTester<int32_t>* m, ExternalReference ref,
int32_t (*wrapper)(Address), Iterable inputs) {
uint8_t buffer[std::max(sizeof(InType), sizeof(OutType))];
constexpr size_t kBufferSize = Max(sizeof(InType), sizeof(OutType));
uint8_t buffer[kBufferSize] = {0};
Address buffer_addr = reinterpret_cast<Address>(buffer);
Node* function = m->ExternalConstant(ref);
@ -138,7 +140,8 @@ template <typename InType, typename OutType, typename Iterable>
void TestExternalReference_ConvertOpWithReturn(
BufferedRawMachineAssemblerTester<OutType>* m, ExternalReference ref,
OutType (*wrapper)(Address), Iterable inputs) {
uint8_t buffer[sizeof(InType)];
constexpr size_t kBufferSize = sizeof(InType);
uint8_t buffer[kBufferSize] = {0};
Address buffer_addr = reinterpret_cast<Address>(buffer);
Node* function = m->ExternalConstant(ref);