Skip to content

Reloading an angrdb from a binary of Hex format fails #1500

@mahaloz

Description

@mahaloz

Description

Normally, load a binary that is in the Hex file format. Now, save it as an angrdb. Now load angr-management from that angrdb. It will to load with the error:

CRITICAL | 2025-10-11 20:00:35,788 | angrmanagement.data.jobs.loading | Failed to load the angr database.
Traceback (most recent call last):
  File "/Users/mahaloz/github/angr-dev/angr/angr/angrdb/db.py", line 42, in open_db
    yield Session
  File "/Users/mahaloz/github/angr-dev/angr/angr/angrdb/db.py", line 184, in load
    loader = LoaderSerializer.load(session)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mahaloz/github/angr-dev/angr/angr/angrdb/serializers/loader.py", line 156, in load
    loader = cle.Loader(BytesIO(main_object.content), main_opts=load_args[main_object])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mahaloz/github/angr-dev/cle/cle/loader.py", line 185, in __init__
    self.initial_load_objects = self._internal_load(
                                ^^^^^^^^^^^^^^^^^^^^
  File "/Users/mahaloz/github/angr-dev/cle/cle/loader.py", line 796, in _internal_load
    obj = self._load_object_isolated(main_spec)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mahaloz/github/angr-dev/cle/cle/loader.py", line 1008, in _load_object_isolated
    result = backend_cls(binary, binary_stream, is_main_bin=self._main_object is None, loader=self, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mahaloz/github/angr-dev/cle/cle/backends/ihex.py", line 127, in __init__
    raise CLEError(
cle.errors.CLEError: To use the Hex binary backend, you need to specify an architecture in the loader options.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/mahaloz/github/angr-dev/angr-management/angrmanagement/data/jobs/loading.py", line 127, in run
    proj = angrdb.load(
           ^^^^^^^^^^^^
  File "/Users/mahaloz/github/angr-dev/angr/angr/angrdb/db.py", line 175, in load
    with self.open_db(db_str) as Session, self.session_scope(Session) as session:
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/Users/mahaloz/github/angr-dev/angr/angr/angrdb/db.py", line 46, in open_db
    raise AngrDBError from ex
angr.errors.AngrDBError

Steps to reproduce the bug

Ping @mahaloz for a binary to reproduce.

Environment

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triageIssue has yet to be looked at by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions