Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 6bb15d2e268a01eefff367e45a2eee5cdb823f6a..6f9ef625c77f730a55da8f95c72aae8c8a60ea25 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -7246,10 +7246,13 @@ MaybeLocal<WasmCompiledModule> WasmCompiledModule::Compile( |
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
i::wasm::ErrorThrower thrower(i_isolate, "WasmCompiledModule::Deserialize()"); |
i::SeqOneByteString* data = i::SeqOneByteString::cast(*module_bytes); |
+ i::ScopedVector<unsigned char> bytes_copy(data->length()); |
titzer
2016/10/07 09:29:58
Can you leave a TODO here, since we eventually mak
Clemens Hammacher
2016/10/07 09:43:27
Done.
|
+ memcpy(bytes_copy.start(), data->GetChars(), data->length()); |
i::MaybeHandle<i::JSObject> maybe_compiled = |
i::wasm::CreateModuleObjectFromBytes( |
- i_isolate, data->GetChars(), data->GetChars() + data->length(), |
- &thrower, i::wasm::ModuleOrigin::kWasmOrigin); |
+ i_isolate, bytes_copy.start(), |
+ bytes_copy.start() + bytes_copy.length(), &thrower, |
+ i::wasm::ModuleOrigin::kWasmOrigin); |
if (maybe_compiled.is_null()) return MaybeLocal<WasmCompiledModule>(); |
return Local<WasmCompiledModule>::Cast( |
Utils::ToLocal(maybe_compiled.ToHandleChecked())); |