| Index: src/wasm/module-decoder.cc
|
| diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc
|
| index 48f59cefa82bdf1d293da3eb529d4244e7dc2485..a0d3ab7dac27af795f748b1158f913f966cddce9 100644
|
| --- a/src/wasm/module-decoder.cc
|
| +++ b/src/wasm/module-decoder.cc
|
| @@ -108,7 +108,7 @@ class ModuleDecoder : public Decoder {
|
| pos = pc_;
|
|
|
| // Read the section name.
|
| - int string_leb_length = 0;
|
| + unsigned string_leb_length = 0;
|
| uint32_t string_length =
|
| consume_u32v(&string_leb_length, "section name length");
|
| const byte* section_name_start = pc_;
|
| @@ -126,7 +126,7 @@ class ModuleDecoder : public Decoder {
|
| WasmSection::lookup(section_name_start, string_length);
|
|
|
| // Read and check the section size.
|
| - int section_leb_length = 0;
|
| + unsigned section_leb_length = 0;
|
| uint32_t section_length =
|
| consume_u32v(§ion_leb_length, "section length");
|
| if (!checkAvailable(section_length)) {
|
| @@ -144,14 +144,14 @@ class ModuleDecoder : public Decoder {
|
| limit_ = pc_;
|
| break;
|
| case WasmSection::Code::Memory: {
|
| - int length;
|
| + unsigned length;
|
| module->min_mem_pages = consume_u32v(&length, "min memory");
|
| module->max_mem_pages = consume_u32v(&length, "max memory");
|
| module->mem_export = consume_u8("export memory") != 0;
|
| break;
|
| }
|
| case WasmSection::Code::Signatures: {
|
| - int length;
|
| + unsigned length;
|
| uint32_t signatures_count = consume_u32v(&length, "signatures count");
|
| module->signatures.reserve(SafeReserve(signatures_count));
|
| // Decode signatures.
|
| @@ -165,7 +165,7 @@ class ModuleDecoder : public Decoder {
|
| break;
|
| }
|
| case WasmSection::Code::FunctionSignatures: {
|
| - int length;
|
| + unsigned length;
|
| uint32_t functions_count = consume_u32v(&length, "functions count");
|
| module->functions.reserve(SafeReserve(functions_count));
|
| for (uint32_t i = 0; i < functions_count; i++) {
|
| @@ -182,7 +182,7 @@ class ModuleDecoder : public Decoder {
|
| break;
|
| }
|
| case WasmSection::Code::FunctionBodies: {
|
| - int length;
|
| + unsigned length;
|
| const byte* pos = pc_;
|
| uint32_t functions_count = consume_u32v(&length, "functions count");
|
| if (functions_count != module->functions.size()) {
|
| @@ -193,7 +193,7 @@ class ModuleDecoder : public Decoder {
|
| }
|
| for (uint32_t i = 0; i < functions_count; i++) {
|
| WasmFunction* function = &module->functions[i];
|
| - int length;
|
| + unsigned length;
|
| uint32_t size = consume_u32v(&length, "body size");
|
| function->code_start_offset = pc_offset();
|
| function->code_end_offset = pc_offset() + size;
|
| @@ -208,7 +208,7 @@ class ModuleDecoder : public Decoder {
|
| break;
|
| }
|
| case WasmSection::Code::Names: {
|
| - int length;
|
| + unsigned length;
|
| const byte* pos = pc_;
|
| uint32_t functions_count = consume_u32v(&length, "functions count");
|
| if (functions_count != module->functions.size()) {
|
| @@ -235,7 +235,7 @@ class ModuleDecoder : public Decoder {
|
| break;
|
| }
|
| case WasmSection::Code::Globals: {
|
| - int length;
|
| + unsigned length;
|
| uint32_t globals_count = consume_u32v(&length, "globals count");
|
| module->globals.reserve(SafeReserve(globals_count));
|
| // Decode globals.
|
| @@ -250,7 +250,7 @@ class ModuleDecoder : public Decoder {
|
| break;
|
| }
|
| case WasmSection::Code::DataSegments: {
|
| - int length;
|
| + unsigned length;
|
| uint32_t data_segments_count =
|
| consume_u32v(&length, "data segments count");
|
| module->data_segments.reserve(SafeReserve(data_segments_count));
|
| @@ -271,7 +271,7 @@ class ModuleDecoder : public Decoder {
|
| case WasmSection::Code::FunctionTable: {
|
| // An indirect function table requires functions first.
|
| CheckForFunctions(module, section);
|
| - int length;
|
| + unsigned length;
|
| uint32_t function_table_count =
|
| consume_u32v(&length, "function table count");
|
| module->function_table.reserve(SafeReserve(function_table_count));
|
| @@ -306,7 +306,7 @@ class ModuleDecoder : public Decoder {
|
| break;
|
| }
|
| case WasmSection::Code::ImportTable: {
|
| - int length;
|
| + unsigned length;
|
| uint32_t import_table_count =
|
| consume_u32v(&length, "import table count");
|
| module->import_table.reserve(SafeReserve(import_table_count));
|
| @@ -339,7 +339,7 @@ class ModuleDecoder : public Decoder {
|
| case WasmSection::Code::ExportTable: {
|
| // Declares an export table.
|
| CheckForFunctions(module, section);
|
| - int length;
|
| + unsigned length;
|
| uint32_t export_table_count =
|
| consume_u32v(&length, "export table count");
|
| module->export_table.reserve(SafeReserve(export_table_count));
|
| @@ -471,7 +471,7 @@ class ModuleDecoder : public Decoder {
|
| // Decodes a single data segment entry inside a module starting at {pc_}.
|
| void DecodeDataSegmentInModule(WasmModule* module, WasmDataSegment* segment) {
|
| const byte* start = pc_;
|
| - int length;
|
| + unsigned length;
|
| segment->dest_addr = consume_u32v(&length, "destination");
|
| segment->source_size = consume_u32v(&length, "source size");
|
| segment->source_offset = static_cast<uint32_t>(pc_ - start_);
|
| @@ -555,7 +555,7 @@ class ModuleDecoder : public Decoder {
|
| // Reads a length-prefixed string, checking that it is within bounds. Returns
|
| // the offset of the string, and the length as an out parameter.
|
| uint32_t consume_string(uint32_t* length, bool validate_utf8) {
|
| - int varint_length;
|
| + unsigned varint_length;
|
| *length = consume_u32v(&varint_length, "string length");
|
| uint32_t offset = pc_offset();
|
| TRACE(" +%u %-20s: (%u bytes)\n", offset, "string", *length);
|
| @@ -568,7 +568,7 @@ class ModuleDecoder : public Decoder {
|
|
|
| uint32_t consume_sig_index(WasmModule* module, FunctionSig** sig) {
|
| const byte* pos = pc_;
|
| - int length;
|
| + unsigned length;
|
| uint32_t sig_index = consume_u32v(&length, "signature index");
|
| if (sig_index >= module->signatures.size()) {
|
| error(pos, pos, "signature index %u out of bounds (%d signatures)",
|
| @@ -582,7 +582,7 @@ class ModuleDecoder : public Decoder {
|
|
|
| uint32_t consume_func_index(WasmModule* module, WasmFunction** func) {
|
| const byte* pos = pc_;
|
| - int length;
|
| + unsigned length;
|
| uint32_t func_index = consume_u32v(&length, "function index");
|
| if (func_index >= module->functions.size()) {
|
| error(pos, pos, "function index %u out of bounds (%d functions)",
|
| @@ -657,7 +657,7 @@ class ModuleDecoder : public Decoder {
|
| kWasmFunctionTypeForm, form);
|
| return nullptr;
|
| }
|
| - int length;
|
| + unsigned length;
|
| // parse parameter types
|
| uint32_t param_count = consume_u32v(&length, "param count");
|
| std::vector<LocalType> params;
|
|
|