We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
AttributeError: 'DefaultMemory' object has no attribute '_unconstrained_range'


**Describe the bug.**

Symbolic Execution crashes deeps inside the memory mixins with `AttributeError: 'DefaultMemory' object has no attribute '_unconstrained_range'`

This is fairly confusing because this happens inside the `UnderconstrainedMixin` which obviously defines `_unconstrained_range` in its constructor, yet, I can confirm with a debugger that I can end up in the crashing line with a `DefaultMemory` object that doesn't. My best guess is that under some circumstances the constructor for `UnderconstrainedMixin` isn't called. I can't properly confirm this though, the initial states generated for the exploration have `DefaultMemory` objects with `_unconstrained_range` initialized as expected.

Nearly all Mixins I checked don't even have a constructor, and for the `UnderconstrainedMixin` the value isn't even an argument, so it could be changed to a class variable as a workaround if this is indeed the case that for some reason the constructor isn't called. 


```
Traceback (most recent call last):
  [...]
  File "/home/fmagin/Projects/angr-dev/angr/angr/sim_state.py", line 587, in step
    return self.project.factory.successors(self, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/factory.py", line 60, in successors
    return self.default_engine.process(*args, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/slicing.py", line 19, in process
    return super().process(*args, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/engine.py", line 149, in process
    self.process_successors(self.successors, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/failure.py", line 21, in process_successors
    return super().process_successors(successors, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/syscall.py", line 18, in process_successors
    return super().process_successors(successors, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/hook.py", line 54, in process_successors
    return super().process_successors(successors, procedure=procedure, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/unicorn.py", line 169, in process_successors
    return super().process_successors(successors, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/soot/engine.py", line 64, in process_successors
    return super().process_successors(successors, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/heavy.py", line 138, in process_successors
    self.handle_vex_block(irsb)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/super_fastpath.py", line 19, in handle_vex_block
    super().handle_vex_block(irsb)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/slicing.py", line 26, in handle_vex_block
    super().handle_vex_block(irsb)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/actions.py", line 30, in handle_vex_block
    super().handle_vex_block(irsb)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/inspect.py", line 45, in handle_vex_block
    super().handle_vex_block(irsb)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/light.py", line 446, in handle_vex_block
    self._handle_vex_stmt(stmt)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/slicing.py", line 30, in _handle_vex_stmt
    super()._handle_vex_stmt(stmt)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/inspect.py", line 40, in _handle_vex_stmt
    super()._handle_vex_stmt(stmt)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/resilience.py", line 36, in inner
    return getattr(super(VEXResilienceMixin, self), func)(*iargs, **ikwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/heavy.py", line 204, in _handle_vex_stmt
    super()._handle_vex_stmt(stmt)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/light.py", line 51, in _handle_vex_stmt
    handler(stmt)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/light.py", line 196, in _handle_vex_stmt_Store
    self._perform_vex_stmt_Store(
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/actions.py", line 177, in _perform_vex_stmt_Store
    super()._perform_vex_stmt_Store(addr, data, end, action=a, condition=condition, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/claripy/datalayer.py", line 93, in _perform_vex_stmt_Store
    super()._perform_vex_stmt_Store(addr, data.raw_to_bv(), endness, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/heavy.py", line 35, in _perform_vex_stmt_Store
    self.state.memory.store(addr, data, endness=endness, action=action, inspect=inspect, condition=condition)
  File "/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/unwrapper_mixin.py", line 8, in store
    return super().store(_raw_ast(addr), _raw_ast(data),
  File "/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/name_resolution_mixin.py", line 50, in store
    return super().store(addr, data, size=size, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/bvv_conversion_mixin.py", line 25, in store
    super().store(addr, data_bv, size=size, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/simplification_mixin.py", line 11, in store
    super().store(addr, real_data, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/clouseau_mixin.py", line 6, in store
    super().store(addr, data,
  File "/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/actions_mixin.py", line 34, in store
    super().store(addr, data, size=size, action=action, condition=condition, **kwargs)
  File "/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/underconstrained_mixin.py", line 20, in store
    self._constrain_underconstrained_index(addr)
  File "/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/underconstrained_mixin.py", line 41, in _constrain_underconstrained_index
    if not self.state.uc_manager.is_bounded(addr) or self.state.solver.max_int(addr) - self.state.solver.min_int(addr) >= self._unconstrained_range:
AttributeError: 'DefaultMemory' object has no attribute '_unconstrained_range'
```


**Environment Information.**
```
angr environment report
=============================
Date: 2021-06-27 15:28:23.293361
Running in virtual environment at /home/fmagin/.virtualenvs/sit-angr-analysis-service
Platform: linux-x86_64
Python version: 3.9.5 (default, May 24 2021, 12:50:35) 
[GCC 11.1.0]
######## angr #########
Python found it in /home/fmagin/Projects/angr-dev/angr/angr
Pip version angr 9.0.gitrolling
Git info:
	Current commit 92f8167e7823d1e88dbb72ed8f716b0fc863cbd9 from branch master
	Checked out from remote origin: https://github.com/angr/angr.git
######## ailment #########
Python found it in /home/fmagin/Projects/angr-dev/ailment/ailment
Pip version ailment 9.0.gitrolling
Git info:
	Current commit 9c3abc9a226f2f3fdca5f56a22d8bd694d2035b4 from branch master
	Checked out from remote origin: https://github.com/angr/ailment.git
######## cle #########
Python found it in /home/fmagin/Projects/angr-dev/cle/cle
Pip version cle 9.0.gitrolling
Git info:
	Current commit d7d80cf4f4a8f7bafb257c17190ea89ab2abaa50 from branch master
	Checked out from remote origin: https://github.com/angr/cle.git
######## pyvex #########
Python found it in /home/fmagin/Projects/angr-dev/pyvex/pyvex
Pip version pyvex 9.0.gitrolling
Git info:
	Current commit b7006517fcb9fcd713b070315b7c18277c942113 from branch master
	Checked out from remote origin: https://github.com/angr/pyvex.git
######## claripy #########
Python found it in /home/fmagin/Projects/angr-dev/claripy/claripy
Pip version claripy 9.0.gitrolling
Git info:
	Current commit d372dd28bede388d44c018b06168239ca335329a from branch master
	Checked out from remote origin: https://github.com/angr/claripy.git
######## archinfo #########
Python found it in /home/fmagin/Projects/angr-dev/archinfo/archinfo
Pip version archinfo 9.0.gitrolling
Git info:
	Current commit b150db4c0a939140966df8b0056b6deb5b07efbf from branch master
	Checked out from remote origin: https://github.com/angr/archinfo.git
######## z3 #########
Python found it in /home/fmagin/.virtualenvs/sit-angr-analysis-service/lib/python3.9/site-packages/z3
Pip version z3-solver 4.8.10.0
Couldn't find git info
######## unicorn #########
Python found it in /home/fmagin/.virtualenvs/sit-angr-analysis-service/lib/python3.9/site-packages/unicorn
Pip version unicorn 1.0.2rc4
Couldn't find git info
######### Native Module Info ##########
angr: <CDLL '/home/fmagin/Projects/angr-dev/angr/angr/lib/angr_native.so', handle 55dc453581c0 at 0x7f9c3fe6c670>
unicorn: <CDLL '/home/fmagin/.virtualenvs/sit-angr-analysis-service/lib/python3.9/site-packages/unicorn/lib/libunicorn.so', handle 55dc44aa1660 at 0x7f9c4559bc40>
pyvex: <cffi.api._make_ffi_library.<locals>.FFILibrary object at 0x7f9c4610a070>
z3: <CDLL '/home/fmagin/.virtualenvs/sit-angr-analysis-service/lib/python3.9/site-packages/z3/lib/libz3.so', handle 55dc44cd3620 at 0x7f9c430f7b80>
```


**To Reproduce.**

Not sure what the minimal PoC for this is, will share one if I can find a simple trigger, but at that point I might have found the solution already anyway.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `angr/storage/memory_mixins/underconstrained_mixin.py`
Content:
```
1 import claripy
2 import logging
3 
4 from . import MemoryMixin
5 from ... import sim_options as o
6 
7 l = logging.getLogger(__name__)
8 
9 class UnderconstrainedMixin(MemoryMixin):
10     def __init__(self, *args, **kwargs):
11         super().__init__(*args, **kwargs)
12 
13         self._unconstrained_range = 1024
14 
15     def load(self, addr, **kwargs):
16         self._constrain_underconstrained_index(addr)
17         return super().load(addr, **kwargs)
18 
19     def store(self, addr, data, **kwargs):
20         self._constrain_underconstrained_index(addr)
21         super().store(addr, data, **kwargs)
22 
23     def _default_value(self, addr, size, name='mem', key=None, inspect=True, events=True, **kwargs):
24         if o.UNDER_CONSTRAINED_SYMEXEC in self.state.options and type(addr) is int:
25             if self.category == 'mem':
26                 alloc_depth = self.state.uc_manager.get_alloc_depth(addr)
27                 uc_alloc_depth = 0 if alloc_depth is None else alloc_depth + 1
28             else:
29                 uc_alloc_depth = 0
30 
31             bits = size * self.state.arch.byte_width
32             return self.state.solver.Unconstrained(name, bits, key=key, inspect=inspect, events=events, uc_alloc_depth=uc_alloc_depth)
33 
34         return super()._default_value(addr, size, name=name, key=key, inspect=inspect, events=events, **kwargs)
35 
36     def _constrain_underconstrained_index(self, addr):
37         if o.UNDER_CONSTRAINED_SYMEXEC in self.state.options and \
38                 isinstance(addr, claripy.ast.Base) and \
39                 addr.uninitialized and \
40                 addr.uc_alloc_depth is not None:
41             if not self.state.uc_manager.is_bounded(addr) or self.state.solver.max_int(addr) - self.state.solver.min_int(addr) >= self._unconstrained_range:
42                 # in under-constrained symbolic execution, we'll assign a new memory region for this address
43                 mem_region = self.state.uc_manager.assign(addr)
44 
45                 # ... but only if it's not already been constrained to something!
46                 if self.state.solver.solution(addr, mem_region):
47                     self.state.add_constraints(addr == mem_region)
48                 l.debug('Under-constrained symbolic execution: assigned a new memory region @ %s to %s', mem_region, addr)
49 
50
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/angr/storage/memory_mixins/underconstrained_mixin.py b/angr/storage/memory_mixins/underconstrained_mixin.py
--- a/angr/storage/memory_mixins/underconstrained_mixin.py
+++ b/angr/storage/memory_mixins/underconstrained_mixin.py
@@ -12,6 +12,12 @@
 
         self._unconstrained_range = 1024
 
+    @MemoryMixin.memo
+    def copy(self, memo):
+        out = super().copy(memo)
+        out._unconstrained_range = self._unconstrained_range
+        return out
+
     def load(self, addr, **kwargs):
         self._constrain_underconstrained_index(addr)
         return super().load(addr, **kwargs)
@@ -46,4 +52,3 @@
                 if self.state.solver.solution(addr, mem_region):
                     self.state.add_constraints(addr == mem_region)
                 l.debug('Under-constrained symbolic execution: assigned a new memory region @ %s to %s', mem_region, addr)
-

{"golden_diff": "diff --git a/angr/storage/memory_mixins/underconstrained_mixin.py b/angr/storage/memory_mixins/underconstrained_mixin.py\n--- a/angr/storage/memory_mixins/underconstrained_mixin.py\n+++ b/angr/storage/memory_mixins/underconstrained_mixin.py\n@@ -12,6 +12,12 @@\n \n         self._unconstrained_range = 1024\n \n+    @MemoryMixin.memo\n+    def copy(self, memo):\n+        out = super().copy(memo)\n+        out._unconstrained_range = self._unconstrained_range\n+        return out\n+\n     def load(self, addr, **kwargs):\n         self._constrain_underconstrained_index(addr)\n         return super().load(addr, **kwargs)\n@@ -46,4 +52,3 @@\n                 if self.state.solver.solution(addr, mem_region):\n                     self.state.add_constraints(addr == mem_region)\n                 l.debug('Under-constrained symbolic execution: assigned a new memory region @ %s to %s', mem_region, addr)\n-\n", "issue": "AttributeError: 'DefaultMemory' object has no attribute '_unconstrained_range'\n\r\n\r\n**Describe the bug.**\r\n\r\nSymbolic Execution crashes deeps inside the memory mixins with `AttributeError: 'DefaultMemory' object has no attribute '_unconstrained_range'`\r\n\r\nThis is fairly confusing because this happens inside the `UnderconstrainedMixin` which obviously defines `_unconstrained_range` in its constructor, yet, I can confirm with a debugger that I can end up in the crashing line with a `DefaultMemory` object that doesn't. My best guess is that under some circumstances the constructor for `UnderconstrainedMixin` isn't called. I can't properly confirm this though, the initial states generated for the exploration have `DefaultMemory` objects with `_unconstrained_range` initialized as expected.\r\n\r\nNearly all Mixins I checked don't even have a constructor, and for the `UnderconstrainedMixin` the value isn't even an argument, so it could be changed to a class variable as a workaround if this is indeed the case that for some reason the constructor isn't called. \r\n\r\n\r\n```\r\nTraceback (most recent call last):\r\n  [...]\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/sim_state.py\", line 587, in step\r\n    return self.project.factory.successors(self, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/factory.py\", line 60, in successors\r\n    return self.default_engine.process(*args, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/slicing.py\", line 19, in process\r\n    return super().process(*args, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/engine.py\", line 149, in process\r\n    self.process_successors(self.successors, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/failure.py\", line 21, in process_successors\r\n    return super().process_successors(successors, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/syscall.py\", line 18, in process_successors\r\n    return super().process_successors(successors, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/hook.py\", line 54, in process_successors\r\n    return super().process_successors(successors, procedure=procedure, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/unicorn.py\", line 169, in process_successors\r\n    return super().process_successors(successors, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/soot/engine.py\", line 64, in process_successors\r\n    return super().process_successors(successors, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/heavy.py\", line 138, in process_successors\r\n    self.handle_vex_block(irsb)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/super_fastpath.py\", line 19, in handle_vex_block\r\n    super().handle_vex_block(irsb)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/slicing.py\", line 26, in handle_vex_block\r\n    super().handle_vex_block(irsb)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/actions.py\", line 30, in handle_vex_block\r\n    super().handle_vex_block(irsb)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/inspect.py\", line 45, in handle_vex_block\r\n    super().handle_vex_block(irsb)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/light.py\", line 446, in handle_vex_block\r\n    self._handle_vex_stmt(stmt)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/slicing.py\", line 30, in _handle_vex_stmt\r\n    super()._handle_vex_stmt(stmt)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/inspect.py\", line 40, in _handle_vex_stmt\r\n    super()._handle_vex_stmt(stmt)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/resilience.py\", line 36, in inner\r\n    return getattr(super(VEXResilienceMixin, self), func)(*iargs, **ikwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/heavy.py\", line 204, in _handle_vex_stmt\r\n    super()._handle_vex_stmt(stmt)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/light.py\", line 51, in _handle_vex_stmt\r\n    handler(stmt)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/light/light.py\", line 196, in _handle_vex_stmt_Store\r\n    self._perform_vex_stmt_Store(\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/actions.py\", line 177, in _perform_vex_stmt_Store\r\n    super()._perform_vex_stmt_Store(addr, data, end, action=a, condition=condition, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/claripy/datalayer.py\", line 93, in _perform_vex_stmt_Store\r\n    super()._perform_vex_stmt_Store(addr, data.raw_to_bv(), endness, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/engines/vex/heavy/heavy.py\", line 35, in _perform_vex_stmt_Store\r\n    self.state.memory.store(addr, data, endness=endness, action=action, inspect=inspect, condition=condition)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/unwrapper_mixin.py\", line 8, in store\r\n    return super().store(_raw_ast(addr), _raw_ast(data),\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/name_resolution_mixin.py\", line 50, in store\r\n    return super().store(addr, data, size=size, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/bvv_conversion_mixin.py\", line 25, in store\r\n    super().store(addr, data_bv, size=size, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/simplification_mixin.py\", line 11, in store\r\n    super().store(addr, real_data, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/clouseau_mixin.py\", line 6, in store\r\n    super().store(addr, data,\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/actions_mixin.py\", line 34, in store\r\n    super().store(addr, data, size=size, action=action, condition=condition, **kwargs)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/underconstrained_mixin.py\", line 20, in store\r\n    self._constrain_underconstrained_index(addr)\r\n  File \"/home/fmagin/Projects/angr-dev/angr/angr/storage/memory_mixins/underconstrained_mixin.py\", line 41, in _constrain_underconstrained_index\r\n    if not self.state.uc_manager.is_bounded(addr) or self.state.solver.max_int(addr) - self.state.solver.min_int(addr) >= self._unconstrained_range:\r\nAttributeError: 'DefaultMemory' object has no attribute '_unconstrained_range'\r\n```\r\n\r\n\r\n**Environment Information.**\r\n```\r\nangr environment report\r\n=============================\r\nDate: 2021-06-27 15:28:23.293361\r\nRunning in virtual environment at /home/fmagin/.virtualenvs/sit-angr-analysis-service\r\nPlatform: linux-x86_64\r\nPython version: 3.9.5 (default, May 24 2021, 12:50:35) \r\n[GCC 11.1.0]\r\n######## angr #########\r\nPython found it in /home/fmagin/Projects/angr-dev/angr/angr\r\nPip version angr 9.0.gitrolling\r\nGit info:\r\n\tCurrent commit 92f8167e7823d1e88dbb72ed8f716b0fc863cbd9 from branch master\r\n\tChecked out from remote origin: https://github.com/angr/angr.git\r\n######## ailment #########\r\nPython found it in /home/fmagin/Projects/angr-dev/ailment/ailment\r\nPip version ailment 9.0.gitrolling\r\nGit info:\r\n\tCurrent commit 9c3abc9a226f2f3fdca5f56a22d8bd694d2035b4 from branch master\r\n\tChecked out from remote origin: https://github.com/angr/ailment.git\r\n######## cle #########\r\nPython found it in /home/fmagin/Projects/angr-dev/cle/cle\r\nPip version cle 9.0.gitrolling\r\nGit info:\r\n\tCurrent commit d7d80cf4f4a8f7bafb257c17190ea89ab2abaa50 from branch master\r\n\tChecked out from remote origin: https://github.com/angr/cle.git\r\n######## pyvex #########\r\nPython found it in /home/fmagin/Projects/angr-dev/pyvex/pyvex\r\nPip version pyvex 9.0.gitrolling\r\nGit info:\r\n\tCurrent commit b7006517fcb9fcd713b070315b7c18277c942113 from branch master\r\n\tChecked out from remote origin: https://github.com/angr/pyvex.git\r\n######## claripy #########\r\nPython found it in /home/fmagin/Projects/angr-dev/claripy/claripy\r\nPip version claripy 9.0.gitrolling\r\nGit info:\r\n\tCurrent commit d372dd28bede388d44c018b06168239ca335329a from branch master\r\n\tChecked out from remote origin: https://github.com/angr/claripy.git\r\n######## archinfo #########\r\nPython found it in /home/fmagin/Projects/angr-dev/archinfo/archinfo\r\nPip version archinfo 9.0.gitrolling\r\nGit info:\r\n\tCurrent commit b150db4c0a939140966df8b0056b6deb5b07efbf from branch master\r\n\tChecked out from remote origin: https://github.com/angr/archinfo.git\r\n######## z3 #########\r\nPython found it in /home/fmagin/.virtualenvs/sit-angr-analysis-service/lib/python3.9/site-packages/z3\r\nPip version z3-solver 4.8.10.0\r\nCouldn't find git info\r\n######## unicorn #########\r\nPython found it in /home/fmagin/.virtualenvs/sit-angr-analysis-service/lib/python3.9/site-packages/unicorn\r\nPip version unicorn 1.0.2rc4\r\nCouldn't find git info\r\n######### Native Module Info ##########\r\nangr: <CDLL '/home/fmagin/Projects/angr-dev/angr/angr/lib/angr_native.so', handle 55dc453581c0 at 0x7f9c3fe6c670>\r\nunicorn: <CDLL '/home/fmagin/.virtualenvs/sit-angr-analysis-service/lib/python3.9/site-packages/unicorn/lib/libunicorn.so', handle 55dc44aa1660 at 0x7f9c4559bc40>\r\npyvex: <cffi.api._make_ffi_library.<locals>.FFILibrary object at 0x7f9c4610a070>\r\nz3: <CDLL '/home/fmagin/.virtualenvs/sit-angr-analysis-service/lib/python3.9/site-packages/z3/lib/libz3.so', handle 55dc44cd3620 at 0x7f9c430f7b80>\r\n```\r\n\r\n\r\n**To Reproduce.**\r\n\r\nNot sure what the minimal PoC for this is, will share one if I can find a simple trigger, but at that point I might have found the solution already anyway.\r\n\n", "before_files": [{"content": "import claripy\nimport logging\n\nfrom . import MemoryMixin\nfrom ... import sim_options as o\n\nl = logging.getLogger(__name__)\n\nclass UnderconstrainedMixin(MemoryMixin):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        self._unconstrained_range = 1024\n\n    def load(self, addr, **kwargs):\n        self._constrain_underconstrained_index(addr)\n        return super().load(addr, **kwargs)\n\n    def store(self, addr, data, **kwargs):\n        self._constrain_underconstrained_index(addr)\n        super().store(addr, data, **kwargs)\n\n    def _default_value(self, addr, size, name='mem', key=None, inspect=True, events=True, **kwargs):\n        if o.UNDER_CONSTRAINED_SYMEXEC in self.state.options and type(addr) is int:\n            if self.category == 'mem':\n                alloc_depth = self.state.uc_manager.get_alloc_depth(addr)\n                uc_alloc_depth = 0 if alloc_depth is None else alloc_depth + 1\n            else:\n                uc_alloc_depth = 0\n\n            bits = size * self.state.arch.byte_width\n            return self.state.solver.Unconstrained(name, bits, key=key, inspect=inspect, events=events, uc_alloc_depth=uc_alloc_depth)\n\n        return super()._default_value(addr, size, name=name, key=key, inspect=inspect, events=events, **kwargs)\n\n    def _constrain_underconstrained_index(self, addr):\n        if o.UNDER_CONSTRAINED_SYMEXEC in self.state.options and \\\n                isinstance(addr, claripy.ast.Base) and \\\n                addr.uninitialized and \\\n                addr.uc_alloc_depth is not None:\n            if not self.state.uc_manager.is_bounded(addr) or self.state.solver.max_int(addr) - self.state.solver.min_int(addr) >= self._unconstrained_range:\n                # in under-constrained symbolic execution, we'll assign a new memory region for this address\n                mem_region = self.state.uc_manager.assign(addr)\n\n                # ... but only if it's not already been constrained to something!\n                if self.state.solver.solution(addr, mem_region):\n                    self.state.add_constraints(addr == mem_region)\n                l.debug('Under-constrained symbolic execution: assigned a new memory region @ %s to %s', mem_region, addr)\n\n", "path": "angr/storage/memory_mixins/underconstrained_mixin.py"}], "after_files": [{"content": "import claripy\nimport logging\n\nfrom . import MemoryMixin\nfrom ... import sim_options as o\n\nl = logging.getLogger(__name__)\n\nclass UnderconstrainedMixin(MemoryMixin):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        self._unconstrained_range = 1024\n\n    @MemoryMixin.memo\n    def copy(self, memo):\n        out = super().copy(memo)\n        out._unconstrained_range = self._unconstrained_range\n        return out\n\n    def load(self, addr, **kwargs):\n        self._constrain_underconstrained_index(addr)\n        return super().load(addr, **kwargs)\n\n    def store(self, addr, data, **kwargs):\n        self._constrain_underconstrained_index(addr)\n        super().store(addr, data, **kwargs)\n\n    def _default_value(self, addr, size, name='mem', key=None, inspect=True, events=True, **kwargs):\n        if o.UNDER_CONSTRAINED_SYMEXEC in self.state.options and type(addr) is int:\n            if self.category == 'mem':\n                alloc_depth = self.state.uc_manager.get_alloc_depth(addr)\n                uc_alloc_depth = 0 if alloc_depth is None else alloc_depth + 1\n            else:\n                uc_alloc_depth = 0\n\n            bits = size * self.state.arch.byte_width\n            return self.state.solver.Unconstrained(name, bits, key=key, inspect=inspect, events=events, uc_alloc_depth=uc_alloc_depth)\n\n        return super()._default_value(addr, size, name=name, key=key, inspect=inspect, events=events, **kwargs)\n\n    def _constrain_underconstrained_index(self, addr):\n        if o.UNDER_CONSTRAINED_SYMEXEC in self.state.options and \\\n                isinstance(addr, claripy.ast.Base) and \\\n                addr.uninitialized and \\\n                addr.uc_alloc_depth is not None:\n            if not self.state.uc_manager.is_bounded(addr) or self.state.solver.max_int(addr) - self.state.solver.min_int(addr) >= self._unconstrained_range:\n                # in under-constrained symbolic execution, we'll assign a new memory region for this address\n                mem_region = self.state.uc_manager.assign(addr)\n\n                # ... but only if it's not already been constrained to something!\n                if self.state.solver.solution(addr, mem_region):\n                    self.state.add_constraints(addr == mem_region)\n                l.debug('Under-constrained symbolic execution: assigned a new memory region @ %s to %s', mem_region, addr)\n", "path": "angr/storage/memory_mixins/underconstrained_mixin.py"}]}