mandiant / mandiant/capa

dynamic: render: ValueError "name not found for call"

Open
#2,619 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug dynamic
Dominant language
Python
Stars
6.2k
Forks
726
Avg merge
11d 11h
Merged PRs (30d)
7

Description

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/spring/Documents/capa/capa/main.py", line 1149, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/spring/Documents/capa/capa/main.py", line 1054, in main
    print(capa.render.vverbose.render(meta, rules, capabilities.matches))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/spring/Documents/capa/capa/render/vverbose.py", line 540, in render
    return render_vverbose(rd.ResultDocument.from_capa(meta, rules, capabilities))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/spring/Documents/capa/capa/render/vverbose.py", line 533, in render_vverbose
    render_rules(console, doc)
  File "/home/spring/Documents/capa/capa/render/vverbose.py", line 516, in render_rules
    render_match(console, doc.meta.analysis.layout, rule, match, indent=1)
  File "/home/spring/Documents/capa/capa/render/vverbose.py", line 332, in render_match
    render_match(console, layout, rule, child, indent=indent + 1, mode=child_mode)
  File "/home/spring/Documents/capa/capa/render/vverbose.py", line 329, in render_match
    render_node(console, layout, rule, match, match.node, indent=indent)
  File "/home/spring/Documents/capa/capa/render/vverbose.py", line 280, in render_node
    render_statement(console, layout, match, node.statement, indent=indent)
  File "/home/spring/Documents/capa/capa/render/vverbose.py", line 182, in render_statement
    render_locations(console, layout, match.locations, indent)
  File "/home/spring/Documents/capa/capa/render/vverbose.py", line 104, in render_locations
    s = f"{v.render_call(layout, location)}\nand {(len(locations) - 1)} more..."
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/spring/Documents/capa/capa/render/verbose.py", line 150, in render_call
    cname = _get_call_name(layout, addr)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/spring/Documents/capa/capa/render/verbose.py", line 112, in _get_call_name
    raise ValueError("name not found for call", addr)
ValueError: ('name not found for call', Address(type=<AddressType.CALL: 'call'>, value=(1476, 2652, 1948, 52762)))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with capa/render/verbose.py, especially _get_call_name and render_call, then follow the call from capa/render/vverbose.py:render_locations shown in the traceback. Reproduce the reported dynamic render case and determine what input leads to a call address without a name; done means the render completes without this ValueError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
reverse-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.