| Index: test/cctest/wasm/test-run-wasm-module.cc
|
| diff --git a/test/cctest/wasm/test-run-wasm-module.cc b/test/cctest/wasm/test-run-wasm-module.cc
|
| index 03ffb7ac65e5917db85ba5957147e552c4cc4927..a3dd35713dfb23ca4c54fdd2a978716de1b8e544 100644
|
| --- a/test/cctest/wasm/test-run-wasm-module.cc
|
| +++ b/test/cctest/wasm/test-run-wasm-module.cc
|
| @@ -237,9 +237,10 @@ class WasmSerializationTest {
|
| }
|
|
|
| void InvalidateVersion() {
|
| - uint32_t* buffer = reinterpret_cast<uint32_t*>(
|
| - const_cast<uint8_t*>(serialized_bytes_.first));
|
| - buffer[SerializedCodeData::kVersionHashOffset] = Version::Hash() + 1;
|
| + uint32_t* slot = reinterpret_cast<uint32_t*>(
|
| + const_cast<uint8_t*>(serialized_bytes_.first) +
|
| + SerializedCodeData::kVersionHashOffset);
|
| + *slot = Version::Hash() + 1;
|
| }
|
|
|
| void InvalidateWireBytes() {
|
| @@ -247,6 +248,13 @@ class WasmSerializationTest {
|
| wire_bytes_.second / 2);
|
| }
|
|
|
| + void InvalidateLength() {
|
| + uint32_t* slot = reinterpret_cast<uint32_t*>(
|
| + const_cast<uint8_t*>(serialized_bytes_.first) +
|
| + SerializedCodeData::kPayloadLengthOffset);
|
| + *slot = 0xfefefefeu;
|
| + }
|
| +
|
| v8::MaybeLocal<v8::WasmCompiledModule> Deserialize() {
|
| ErrorThrower thrower(current_isolate(), "");
|
| v8::MaybeLocal<v8::WasmCompiledModule> deserialized =
|
| @@ -406,6 +414,17 @@ TEST(DeserializeNoSerializedData) {
|
| Cleanup();
|
| }
|
|
|
| +TEST(DeserializeInvalidLength) {
|
| + WasmSerializationTest test;
|
| + {
|
| + HandleScope scope(test.current_isolate());
|
| + test.InvalidateLength();
|
| + test.DeserializeAndRun();
|
| + }
|
| + Cleanup(test.current_isolate());
|
| + Cleanup();
|
| +}
|
| +
|
| TEST(DeserializeWireBytesAndSerializedDataInvalid) {
|
| WasmSerializationTest test;
|
| {
|
|
|