Python integer conversion error when decompiling some contracts: "OverflowError: Python int too large to convert to C ssize_t"
0xl3x1 opened this issue · 3 comments
0xl3x1 commented
One example contract which produces this error (several different contracts do):
0x1a9559716cafded0b9573768ea52ee29e922b687_2271995_runtime.txt
Traceback (most recent call last):
File "../../bin/decompile", line 206, in <module>
cfg = tac_cfg.TACGraph.from_bytecode(args.infile)
File "/home/lexi/repos/vandal/bin/../src/tac_cfg.py", line 123, in from_bytecode
return cls(blockparse.EVMBytecodeParser(bytecode).parse())
File "/home/lexi/repos/vandal/bin/../src/tac_cfg.py", line 99, in __init__
self.apply_operations()
File "/home/lexi/repos/vandal/bin/../src/tac_cfg.py", line 260, in apply_operations
block.apply_operations(use_sets)
File "/home/lexi/repos/vandal/bin/../src/tac_cfg.py", line 1189, in apply_operations
op.lhs.values = mem.Variable.arith_op(op.opcode.name, rhs).values
File "/home/lexi/repos/vandal/bin/../src/memtypes.py", line 270, in arith_op
result = ssle.cartesian_map(getattr(cls, opname), args)
File "/home/lexi/repos/vandal/bin/../src/lattice.py", line 316, in cartesian_map
return cls([f(*args) for args in prod])
File "/home/lexi/repos/vandal/bin/../src/lattice.py", line 316, in <listcomp>
return cls([f(*args) for args in prod])
File "/home/lexi/repos/vandal/bin/../src/memtypes.py", line 392, in BYTE
return (v >> ((cls.SIZE - b) * 8)) & 0xFF
OverflowError: Python int too large to convert to C ssize_t
➜ python --version
Python 3.6.1 :: Continuum Analytics, Inc.
0xl3x1 commented
Looks like there's actually a few different Python exceptions happening when bulk-analysing contracts scraped from the chain:
./batch_0.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_10.txt.out:TypeError: 'NoneType' object cannot be interpreted as an integer
./batch_11.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_12.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_12.txt.out:OverflowError: cannot fit 'int' into an index-sized integer
./batch_12.txt.out:OverflowError: cannot fit 'int' into an index-sized integer
./batch_13.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_13.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_13.txt.out:OverflowError: cannot fit 'int' into an index-sized integer
./batch_13.txt.out:AttributeError: 'NoneType' object has no attribute 'exit_stack'
./batch_14.txt.out:MemoryError
./batch_14.txt.out:MemoryError
./batch_15.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_16.txt.out:ModuleNotFoundError: No module named 'configparser'
./batch_16.txt.out:ImportError: No module named 'networkx'
./batch_16.txt.out:ValueError: negative shift count
./batch_17.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_17.txt.out:ModuleNotFoundError: No module named 'cPickle'
./batch_17.txt.out:ModuleNotFoundError: No module named '_compat_pickle'
./batch_17.txt.out:ImportError: No module named 'networkx'
./batch_17.txt.out:AttributeError: 'NoneType' object has no attribute 'exit_stack'
./batch_17.txt.out:OverflowError: cannot fit 'int' into an index-sized integer
./batch_18.txt.out:ImportError: No module named 'networkx'
./batch_18.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_18.txt.out:ValueError: negative shift count
./batch_19.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_19.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_1.txt.out:TypeError: 'NoneType' object cannot be interpreted as an integer
./batch_20.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_20.txt.out:OverflowError: cannot fit 'int' into an index-sized integer
./batch_20.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_21.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_21.txt.out:ValueError: negative shift count
./batch_21.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_22.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_22.txt.out:OverflowError: cannot fit 'int' into an index-sized integer
./batch_23.txt.out:ImportError: No module named 'networkx'
./batch_23.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_23.txt.out:OverflowError: cannot fit 'int' into an index-sized integer
./batch_23.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_23.txt.out:TypeError: 'NoneType' object cannot be interpreted as an integer
./batch_24.txt.out:ValueError: negative shift count
./batch_24.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_24.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_24.txt.out:AttributeError: 'NoneType' object has no attribute 'exit_stack'
./batch_25.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_26.txt.out:ImportError: No module named 'networkx'
./batch_26.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_26.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_26.txt.out:AttributeError: 'NoneType' object has no attribute 'exit_stack'
./batch_27.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_28.txt.out:OverflowError: cannot fit 'int' into an index-sized integer
./batch_28.txt.out:OverflowError: cannot fit 'int' into an index-sized integer
./batch_28.txt.out:TypeError: 'NoneType' object cannot be interpreted as an integer
./batch_2.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_2.txt.out:AttributeError: 'NoneType' object has no attribute 'exit_stack'
./batch_2.txt.out:ValueError: max() arg is an empty sequence
./batch_30.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_30.txt.out:ValueError: negative shift count
./batch_30.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_31.txt.out:ValueError: negative shift count
./batch_32.txt.out:ImportError: No module named 'networkx'
./batch_32.txt.out:MemoryError
./batch_33.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_33.txt.out:TypeError: 'NoneType' object cannot be interpreted as an integer
./batch_33.txt.out:ValueError: negative shift count
./batch_34.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_35.txt.out:OverflowError: cannot fit 'int' into an index-sized integer
./batch_36.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_37.txt.out:AttributeError: 'NoneType' object has no attribute 'exit_stack'
./batch_37.txt.out:TypeError: 'NoneType' object cannot be interpreted as an integer
./batch_38.txt.out:OverflowError: Python int too large to convert to C ssize_t
./batch_39.txt.out:ImportError: No module named 'networkx'
./batch_39.txt.out:OverflowError: cannot fit 'int' into an index-sized integer
./batch_3.txt.out:OverflowError: cannot fit 'int' into an index-sized integer
./batch_4.txt.out:ModuleNotFoundError: No module named 'cPickle'
./batch_4.txt.out:ModuleNotFoundError: No module named '_compat_pickle'
./batch_4.txt.out:ImportError: No module named 'networkx'
./batch_5.txt.out:OverflowError: cannot fit 'int' into an index-sized integer
./batch_5.txt.out:AttributeError: 'NoneType' object has no attribute 'exit_stack'
./batch_5.txt.out:AttributeError: 'NoneType' object has no attribute 'exit_stack'
./batch_7.txt.out:TypeError: 'NoneType' object cannot be interpreted as an integer
./batch_8.txt.out:MemoryError
./batch_9.txt.out:OverflowError: Python int too large to convert to C ssize_t
Strangely, networkx
is installed. :/ It's possible that Python was being updated at the same time as this batch running though. I will need to confirm these errors.
0xl3x1 commented
OK, here's a more realistic list of the Python errors that occurred in Vandal when running over a scrape of all contracts from the chain:
➜ grep 'Error:' *.err | cut -d: -f2- | sort -u
AttributeError: 'NoneType' object has no attribute 'exit_stack'
OverflowError: cannot fit 'int' into an index-sized integer
OverflowError: Python int too large to convert to C ssize_t
TypeError: 'NoneType' object cannot be interpreted as an integer
ValueError: max() arg is an empty sequence
ValueError: negative shift count
hope2028 commented
The same problem