| Index: src/wasm/module-decoder.cc
|
| diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc
|
| index 550a2bd61779189a04490082686588e41d13afec..97d1a62da659e7ea5cd1c67079b295ad24653b65 100644
|
| --- a/src/wasm/module-decoder.cc
|
| +++ b/src/wasm/module-decoder.cc
|
| @@ -180,14 +180,14 @@ class ModuleDecoder : public Decoder {
|
| ModuleOrigin origin)
|
| : Decoder(module_start, module_end), module_zone(zone), origin_(origin) {
|
| result_.start = start_;
|
| - if (limit_ < start_) {
|
| + if (end_ < start_) {
|
| error(start_, "end is less than start");
|
| - limit_ = start_;
|
| + end_ = start_;
|
| }
|
| }
|
|
|
| virtual void onFirstError() {
|
| - pc_ = limit_; // On error, terminate section decoding loop.
|
| + pc_ = end_; // On error, terminate section decoding loop.
|
| }
|
|
|
| void DumpModule(const ModuleResult& result) {
|
| @@ -200,7 +200,7 @@ class ModuleDecoder : public Decoder {
|
| }
|
| }
|
| // File are named `HASH.{ok,failed}.wasm`.
|
| - size_t hash = base::hash_range(start_, limit_);
|
| + size_t hash = base::hash_range(start_, end_);
|
| char buf[32] = {'\0'};
|
| #if V8_OS_WIN && _MSC_VER < 1900
|
| #define snprintf sprintf_s
|
| @@ -209,7 +209,7 @@ class ModuleDecoder : public Decoder {
|
| result.ok() ? "ok" : "failed");
|
| std::string name(buf);
|
| if (FILE* wasm_file = base::OS::FOpen((path + name).c_str(), "wb")) {
|
| - fwrite(start_, limit_ - start_, 1, wasm_file);
|
| + fwrite(start_, end_ - start_, 1, wasm_file);
|
| fclose(wasm_file);
|
| }
|
| }
|
| @@ -572,7 +572,7 @@ class ModuleDecoder : public Decoder {
|
| function->code_end_offset = pc_offset() + size;
|
| if (verify_functions) {
|
| ModuleBytesEnv module_env(module, nullptr,
|
| - ModuleWireBytes(start_, limit_));
|
| + ModuleWireBytes(start_, end_));
|
| VerifyFunctionBody(i + module->num_imported_functions, &module_env,
|
| function);
|
| }
|
| @@ -651,7 +651,7 @@ class ModuleDecoder : public Decoder {
|
| function->name_offset = 0; // ---- name
|
| function->name_length = 0; // ---- name length
|
| function->code_start_offset = off(pc_); // ---- code start
|
| - function->code_end_offset = off(limit_); // ---- code end
|
| + function->code_end_offset = off(end_); // ---- code end
|
|
|
| if (ok()) VerifyFunctionBody(0, module_env, function);
|
|
|
| @@ -729,7 +729,7 @@ class ModuleDecoder : public Decoder {
|
| segment->source_offset = static_cast<uint32_t>(pc_ - start_);
|
|
|
| // Validate the data is in the module.
|
| - uint32_t module_limit = static_cast<uint32_t>(limit_ - start_);
|
| + uint32_t module_limit = static_cast<uint32_t>(end_ - start_);
|
| if (!IsWithinLimit(module_limit, segment->source_offset,
|
| segment->source_size)) {
|
| error(start, "segment out of bounds of module");
|
|
|