Description
Recently introduced code in angr >= v9.2.29 (9995e2958bb248bbfd2e30ecde0c20acd0ab5853) to split memory stores which use the Concat operation seems to result in the following error:
...
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/unwrapper_mixin.py", line 8, in store
return super().store(_raw_ast(addr), _raw_ast(data),
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/name_resolution_mixin.py", line 54, in store
return super().store(addr, data, size=size, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/bvv_conversion_mixin.py", line 25, in store
super().store(addr, data_bv, size=size, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/simplification_mixin.py", line 11, in store
super().store(addr, real_data, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/clouseau_mixin.py", line 41, in store
super().store(addr, data,
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/actions_mixin.py", line 34, in store
super().store(addr, data, size=size, action=action, condition=condition, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/underconstrained_mixin.py", line 27, in store
super().store(addr, data, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/size_resolution_mixin.py", line 88, in store
super().store(addr, data, size=size, condition=condition, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/size_resolution_mixin.py", line 47, in store
super().store(addr, data, size=out_size, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/address_concretization_mixin.py", line 325, in store
self._store_one_addr(addr, data, True, addr, condition, size, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/address_concretization_mixin.py", line 319, in _store_one_addr
super().store(concrete_addr, data, size=size, condition=sub_condition, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/actions_mixin.py", line 74, in store
return super().store(addr, data, action=action, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/conditional_store_mixin.py", line 17, in store
super().store(addr, data, size=size, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/convenient_mappings_mixin.py", line 44, in store
return super().store(addr, data, size=size, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/dirty_addrs_mixin.py", line 8, in store
super().store(addr, data, size=size, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py", line 186, in store
sub_data, sub_data_base, sub_data_size = sub_gen.send(sub_size - written_size)
File "/usr/local/lib/python3.8/dist-packages/angr/storage/memory_mixins/paged_memory/pages/cooperation.py", line 109, in _decompose_objects
cur_data = data.args[start_offset].concat(*data.args[start_offset + 1:start_offset + size])
IndexError: tuple index out of range
data.args[start_offset]
seems problematic, as args is a tuple of symbolic arguments, but it is being indexed by a memory offset.
Steps to reproduce the bug
Perform a memory store on an AST which involves a Concat operation on a state which uses paged memory; I think the object size must also be larger than the page size. For instance,
st.memory.store(0xbe000000, claripy.Concat(claripy.BVS('foo', 3000 * 8), claripy.BVS('bar', 5000 * 8)))
(where st
is an angr.SimState
) will reproduce the error if the page size is 4096 bytes.
Environment
My environment is somewhat noncompliant with recommended defaults due to conflicts with other packages in use:
- Installed without a virtual environment (in a Docker container).
- Unicorn version 2.0.0 is installed, which is incompatible with angr, but I am not using Unicorn mode.
I don't think these impact this issue, but let me know if it is not reproducible.
Output of python3 -m angr.misc.bug_report
:
/usr/local/lib/python3.8/dist-packages/angr/misc/bug_report.py:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
angr environment report
=============================
Date: 2023-01-02 01:31:40.160383
!!! running in global environment. Are you sure? !!!
Platform: linux-x86_64
Python version: 3.8.10 (default, Nov 14 2022, 12:59:47)
[GCC 9.4.0]
######## angr #########
Python found it in /usr/local/lib/python3.8/dist-packages/angr
Pip version angr 9.2.31
Couldn't find git info
######## ailment #########
Python found it in /usr/local/lib/python3.8/dist-packages/ailment
Pip version ailment 9.2.31
Couldn't find git info
######## cle #########
Python found it in /usr/local/lib/python3.8/dist-packages/cle
Pip version cle 9.2.31
Couldn't find git info
######## pyvex #########
Python found it in /usr/local/lib/python3.8/dist-packages/pyvex
Pip version pyvex 9.2.31
Couldn't find git info
######## claripy #########
Python found it in /usr/local/lib/python3.8/dist-packages/claripy
Pip version claripy 9.2.31
Couldn't find git info
######## archinfo #########
Python found it in /usr/local/lib/python3.8/dist-packages/archinfo
Pip version archinfo 9.2.31
Couldn't find git info
######## z3 #########
Python found it in /usr/local/lib/python3.8/dist-packages/z3
Pip version z3-solver 4.10.2.0
Couldn't find git info
######## unicorn #########
Python found it in /usr/local/lib/python3.8/dist-packages/unicorn
Pip version unicorn 2.0.0
Couldn't find git info
######### Native Module Info ##########
angr: <CDLL '/usr/local/lib/python3.8/dist-packages/angr/state_plugins/../lib/angr_native.so', handle 1a3f8c0 at 0x7f9da666c640>
unicorn: <CDLL '/usr/local/lib/python3.8/dist-packages/unicorn/lib/libunicorn.so.2', handle 144b610 at 0x7f9dab70aeb0>
pyvex: <cffi.api._make_ffi_library.<locals>.FFILibrary object at 0x7f9dac3057c0>
z3: <CDLL '/usr/local/lib/python3.8/dist-packages/z3/lib/libz3.so', handle 18292d0 at 0x7f9dab647fa0>
Additional context
Downgrading to angr 9.2.28 mitigated the issue.
Please let me know if more information is required.
bug