Commit graph

32 commits

Author SHA1 Message Date
Fish
61bac8ffd0
SimConstantVariable: Fix overflows and value out of range errors. (#6738)
* SimConstantVariable: Fix overflows and value out of range errors.

* Fix usages of SimConstantVariable.

* Mask the value.

* Fix negative values.
2026-07-29 13:58:20 -07:00
pre-commit-ci[bot]
d38cc5a019
[pre-commit.ci] pre-commit autoupdate (#6721)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.15.22 → v0.16.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.22...v0.16.0)

* Apply fixes

* Add values()

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kevin Phoenix <kevin@kphoenix.us>
2026-07-29 13:46:11 -07:00
Fish
8608d976e3
Decompiler: Fix re-rendering of decompilation caches reloaded from angrDb. (#6669)
* Decompiler: Fix re-rendering of decompilation caches reloaded from angrdb.

Re-rendering a deserialized codegen (as angr-management does on display/edit)
dropped variable declarations and string constants and rendered slightly different
C, because several pieces of state were not restored:

- VariableManagerInternal never serialized variable_to_types / variables_with_
  manual_types, so get_variable_type() returned None and all locals rendered as int.
- parse_codegen did not attach the project, and left display options that serialize
  as None (e.g. max_str_len) unset. Attach project and initialize display options
  from the codegen constructor defaults.
- CConstant string references lost MemoryData.content (not serialized); re-read it
  from the loader at parse time so strings render as strings, not raw addresses.
- regenerate_text() now refreshes CFunction.unified_local_vars from the (restored or
  updated) variable manager so declarations reflect current types.
- CBinaryOp._cstyle_null_cmp is rebuilt from the codegen flag in set_codegen,
  restoring !x vs x == 0.
- Compound-assignment folding (x += 1) compared unified variables by identity; use
  == so it works across deserialized variables that are equal but not the same
  object.

Adds an end-to-end test (1after909::doit) asserting a reloaded cache re-renders
byte-identically.

* Lint code.
2026-07-22 05:01:09 -07:00
Fish
2eadec31c6
Decompiler: Tolerate peephole optimizations not importable at parse time. (#6668)
* Decompiler: Tolerate peephole optimizations not importable at parse time.

* Lint code.
2026-07-22 03:56:06 -07:00
Fish
02c374b5b4
DecompilationCache: Serialization support. (#6624)
Also,

- Refactored variable_kb into kb.dec_variables.

- Spill decompilation cache into RuntimeDb.

- Save decompilation cache into angrDb. Decompilation results can be preserved across runs.

- No longer check in _pb2.py files; they are generated during build.
2026-07-22 03:03:40 -07:00
Fish
77ea846527
angrDb: Direct load and store of serialized bytes for CFG and functions. (#6610)
* Move serialized functions directly into LMDB on load.

* Serialize the callgraph instead of rebuilding it on load.

* Move serialized CFG nodes directly into LMDB on angrdb load.

* Copy clean spilled functions directly from LMDB on dump.

* Do not serialize empty variable managers.

* Serialize CFG edges at the key level to avoid node materialization.

* Bulk-insert function and variable rows via SQLAlchemy Core.

* Skip the CFGNode.function_address fill when node records carry it.

* struct-pack spilled edge data instead of protobuf.

* Avoid O(n^2) full-LRU-order copy in spilling eviction.

* Byte-copy clean spilled CFG nodes when serializing a CFG model.

* Lint code.
2026-07-15 01:40:46 -07:00
Fish
b17f62eb35
Fix pickling of Projects with active RtDb. (#6602)
* Fix pickling of Projects with active RtDb.

* Lint code.
2026-07-10 01:25:55 -07:00
Kevin Phoenix
6f20ff69c5
Fix many delayed imports (#6458)
* Fix many delayed imports

* Add import paths for readability
2026-06-04 11:33:16 -07:00
Kevin Phoenix
f939c5b88c
Enable ruff isort rule (#6452)
* Enable ruff isort rule

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-06-02 14:48:07 -07:00
Fish
8353268906
RuntimeDb: Fix pickling. (#6425) 2026-05-20 15:27:00 -07:00
Nikhil Chapre
4bf07bf0e9
Fixed angrdb loader for raw blobs and HEX backend files (#6288)
* Fixed serialization for angrdb in raw blobs

* Fixed angrdb loader for raw blobs and hex backends
2026-04-07 09:00:40 -07:00
Chensheng Yu
0e488de968
AngrDB: Support loading Loader with multiple objects (#6290) 2026-03-30 17:25:12 -07:00
Fish
78799acd95
CFGModel: Spilling CFG nodes to RtDb. (#6092)
* Preliminary implementation of a spilling CFG graph.

* Fix some test cases.

* Fix another test case.

* Fixes.

* Lint code.

* Implement InEdgeView and OutEdgeView.

* Implement InDegreeView and OutDegreeView.

* Fixes.

* Use (Node.addr, Node.size) as key.

* Fix test cases.

* More fixes.

* Fix CFGENode support.

* Fix the remaining issues.

* Get rid of SpillingCFGGraph.reverse().

* Some refactoring.

* Oops

* Fix perf issue.

* Fix set size change error during key iteration.

* Fix db_batch_size assignment. Fix some test cases.

* SpillingCFGNodeDict.__setstate__: Initialize self._all_keys.

* Getting rid of the nodes dictionary.

* Fix logic in cfg_emulated.py

* Multiple fixes.

* Type annotation fix.

* Fix missing edges after merging CFGNodes.

* Fix more logic.

* Add Soot CFGNodes to the CFG model.

* Lint and type check.

* Add USE_SPILLING_CFGNODE_DICT and CFGNode.dirty.

* Oops

* Lint code.

* No more pickling of CFGNodes.

* Fix no_ret being None.

* Lint code.

* Some refactor; Destroy the fallback mechanism.

* Fix node dirty bug after deserialization.
2026-02-24 09:40:02 -07:00
Yibo Liu
22b1d256dd
Fix some bugs in AngrDB (#6109)
* Fix some bugs in AngrDB
* Mark loaded functions as dirty so SpillingFunctionDict will save it to LMDB upon eviction
* Restore unresolvable target hooks

* AngrDB: Make sure self.project is not None in dump

* Refactor the code.

---------

Co-authored-by: Fish <fishw@asu.edu>
2026-02-09 20:11:22 -07:00
Fish
4f4c84eb97
AngrDb: Implement serialization for SimConstantVariable; Fix #5990. (#6056)
* AngrDb: Implement serialization for SimConstantVariable; Fix #5990.

* Fix db loading path.

* Lint and type check.
2026-01-27 09:46:26 -07:00
pre-commit-ci[bot]
563fb5f862
[pre-commit.ci] pre-commit autoupdate (#6025)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.11 → v0.14.13](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.11...v0.14.13)
- [github.com/psf/black-pre-commit-mirror: 25.12.0 → 26.1.0](https://github.com/psf/black-pre-commit-mirror/compare/25.12.0...26.1.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-01-19 13:37:06 -07:00
Fish
eb6871f099
Remove pickle from StructuredCode, CFG, and Function graph serialization. (#5786)
* Remove pickle from StructuredCode, CFG, and Function graph serialization.

* More fixes; regenerate proto files.

* Fix proto deserialization.
2025-11-12 23:44:47 -07:00
pre-commit-ci[bot]
129bd9e645
[pre-commit.ci] pre-commit autoupdate (#5661)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.12 → v0.13.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.12...v0.13.1)
- [github.com/psf/black: 25.1.0 → 25.9.0](https://github.com/psf/black/compare/25.1.0...25.9.0)

* Fix errors

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kevin Phoenix <kevin@kphoenix.us>
2025-09-22 11:45:43 -07:00
Fish
dc20f85f2c
SimStackVariable: Force offset to be within int32 range during serialization. (#5153)
* SimStackVariable: Force offset to be within int32 range during serialization.

* Add a test case.
2025-01-07 00:52:29 -07:00
Fish
ced9ec67dc
support multiple knowledge bases for on-the-fly creation and serialization. (#5008)
* support multiple knowledge bases for on-the-fly creation and serialization.


Co-authored-by: Yan Shoshitaishvili <zardus@emotionlabs.io>
2024-10-24 14:53:57 -07:00
pre-commit-ci[bot]
0fc6a7d890
[pre-commit.ci] pre-commit autoupdate (#4997)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/abravalheri/validate-pyproject: v0.20.2 → v0.21](https://github.com/abravalheri/validate-pyproject/compare/v0.20.2...v0.21)
- [github.com/astral-sh/ruff-pre-commit: v0.6.9 → v0.7.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.9...v0.7.0)

* Fix SIM115 failures

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kevin Phoenix <kevin@kphoenix.us>
2024-10-21 16:31:28 -07:00
Kevin Phoenix
fa56ba3668
Use ruff TID252 to prevent reletive imports from parents (#4916) 2024-10-01 09:06:33 -07:00
Kevin Phoenix
613c41878d
Add ruff C4 lints (#4796)
* Add C4 lints

* Improve lint
2024-08-29 21:38:42 -07:00
Kevin Phoenix
feda6f6909
Apply ruff SIM lints (#4793)
* Apply SIM lints

* Fix some failing tests

* Fix more bugs
2024-08-29 16:56:53 -07:00
Kevin Phoenix
28c3d3785e
Adopt ruff UP lints (#4792) 2024-08-29 13:03:39 -07:00
Kevin Phoenix
ee464d0338
Adopt from __future__ import annotations (#4790) 2024-08-28 18:31:43 -07:00
Fish
76847a9b3a
AngrDb: Store and use load args for cle backends. (#4721)
* AngrDb: Store and use load args for cle backends.

* Fix loader._main_binary_path and add a CFG to the test case.

* Lint file.
2024-07-27 20:46:00 -07:00
Fish
ae75bf3349
Fix a angrdb test case that raises exceptions on Windows. (#4579) 2024-04-13 01:04:47 -07:00
Fish
056a57ba25
AngrDb: Support saving the db when the original binary no longer exists. (#4410) 2024-01-12 02:14:17 -07:00
Fish
8ef879f1cf
CFGFast: Store full strings in MemoryData for overlapping string references. (#4223)
* CFGFast: Store full strings in MemoryData for overlapping string references.

* MemoryData.content can be None.
2023-10-11 13:51:46 -07:00
Fish
a3d4e252d1
AngrDb: Fix missing nodes in callgraphs after loading the db. (#4213) 2023-09-27 12:01:25 -07:00
Matt Borgerson
17bad29fa6 tests: Structure test files into directories
* Initial pass, loosely following angr package layout
* Many updates to use the 'common' module for binaries repo
* Some unused imports and log handlers are cleaned up
2023-09-08 16:05:33 -07:00