octopus icon indicating copy to clipboard operation
octopus copied to clipboard

error with WASM module

Open xuxu9110 opened this issue 5 years ago • 0 comments

When I run the wasm test I get these results:

`[] WebAssembly Disassembler [] E

ERROR: testDisassemble (WASM.test_disassembler.WasmDisassemblerTestCase)

Traceback (most recent call last): File "/home/xuxu9110/octopus/octopus/tests/WASM/test_disassembler.py", line 44, in testDisassemble disasmModule(bytecode_hex, 2, 14) File "/home/xuxu9110/octopus/octopus/tests/WASM/test_disassembler.py", line 25, in disasmModule funcs = WasmDisassembler().disassemble_module(bytecode) File "/usr/local/lib/python3.6/dist-packages/octopus-0.3.3-py3.6.egg/octopus/arch/wasm/disassembler.py", line 117, in disassemble_module functions = self.extract_functions_code(bytecode[offset:]) File "/usr/local/lib/python3.6/dist-packages/octopus-0.3.3-py3.6.egg/octopus/arch/wasm/disassembler.py", line 94, in extract_functions_code sections = list(mod_iter) File "/usr/local/lib/python3.6/dist-packages/octopus-0.3.3-py3.6.egg/octopus/arch/wasm/decode.py", line 71, in decode_module sec_len, sec_data, _ = sec.from_raw(None, module_wnd) File "/usr/local/lib/python3.6/dist-packages/wasm-1.2-py3.6.egg/wasm/types.py", line 302, in from_raw data_len, val, data_type = cur_field.from_raw(data, raw[offs:]) File "/usr/local/lib/python3.6/dist-packages/wasm-1.2-py3.6.egg/wasm/types.py", line 188, in from_raw return self.choice_field_map[choice].from_raw(ctx, raw) File "/usr/local/lib/python3.6/dist-packages/wasm-1.2-py3.6.egg/wasm/types.py", line 302, in from_raw data_len, val, data_type = cur_field.from_raw(data, raw[offs:]) File "/usr/local/lib/python3.6/dist-packages/wasm-1.2-py3.6.egg/wasm/types.py", line 143, in from_raw length, item, element_type = self.field.from_raw(ctx, raw[offs:]) File "/usr/local/lib/python3.6/dist-packages/wasm-1.2-py3.6.egg/wasm/types.py", line 302, in from_raw data_len, val, data_type = cur_field.from_raw(data, raw[offs:]) File "/usr/local/lib/python3.6/dist-packages/wasm-1.2-py3.6.egg/wasm/types.py", line 72, in from_raw segment = byte2int(raw[offs]) IndexError: index out of bounds on dimension 1


Ran 1 test in 0.002s

FAILED (errors=1) [] WebAssembly ControlFlowGraph & CallGraph analysis [] E

ERROR: testCallGraph (WASM.test_cfg.WasmCFGraphTestCase)

Traceback (most recent call last): File "/home/xuxu9110/octopus/octopus/tests/WASM/test_cfg.py", line 59, in testCallGraph callgraph(module_bytecode, r_nodes, len_call_edges, fname=True) File "/home/xuxu9110/octopus/octopus/tests/WASM/test_cfg.py", line 13, in callgraph cfg = WasmCFG(bytecode) File "/usr/local/lib/python3.6/dist-packages/octopus-0.3.3-py3.6.egg/octopus/arch/wasm/cfg.py", line 291, in init self.analyzer = WasmModuleAnalyzer(self.module_bytecode) File "/usr/local/lib/python3.6/dist-packages/octopus-0.3.3-py3.6.egg/octopus/arch/wasm/analyzer.py", line 57, in init self.analyze() File "/usr/local/lib/python3.6/dist-packages/octopus-0.3.3-py3.6.egg/octopus/arch/wasm/analyzer.py", line 419, in analyze sections = list(mod_iter) File "/usr/local/lib/python3.6/dist-packages/octopus-0.3.3-py3.6.egg/octopus/arch/wasm/decode.py", line 71, in decode_module sec_len, sec_data, _ = sec.from_raw(None, module_wnd) File "/usr/local/lib/python3.6/dist-packages/wasm-1.2-py3.6.egg/wasm/types.py", line 302, in from_raw data_len, val, data_type = cur_field.from_raw(data, raw[offs:]) File "/usr/local/lib/python3.6/dist-packages/wasm-1.2-py3.6.egg/wasm/types.py", line 188, in from_raw return self.choice_field_map[choice].from_raw(ctx, raw) KeyError: 110


Ran 1 test in 0.024s

FAILED (errors=1)`

What's more, when I try to convert EOS contracts into SSA representation I get error 'pop from empty list'. Is there any way to fix it ASAP, or is there any project that can do the convert currently?

xuxu9110 avatar May 09 '20 11:05 xuxu9110