Skip to content

Regression: crash in compute_static_layout when using binja extractor #2734

@xusheng6

Description

@xusheng6

I got this crash today when I analyze 2f7f5fb5de175e770d7eae87666f9831.elf_. Note -- #2732 must be applied first or otherwise you will get a crash before getting to compute_static_layout

Traceback (most recent call last):
  File "/Users/xusheng/capa-env/bin/capa", line 7, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/xusheng/capa/capa/main.py", line 1042, in main
    meta.analysis.layout = capa.loader.compute_layout(rules, extractor, capabilities.matches)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xusheng/capa/capa/loader.py", line 675, in compute_layout
    return compute_static_layout(rules, extractor, capabilities)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xusheng/capa/capa/loader.py", line 653, in compute_static_layout
    assert addr in functions_by_bb
           ^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

This issue is long known, it was first reported in #2406 (comment). I then tracked down the root cause #2516, which is then fixed by #2523. This also led to the creation of a binja issue: Vector35/binaryninja-api#6222

It is unclear to me what is causing the regression

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions