question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: 'XRef' object has no attribute 'sort'

See original GitHub issue

python3.9 macOS Monterey 12.1 angr 9.1.11752 angr-utils 0.5.0 bingraphvis 0.3.0

import angr
from angrutils import *


def cfgfastpng(filename):
    proj = angr.Project(filename, auto_load_libs = False)
    cfg = proj.analyses.CFGFast()
    plot_cfg(cfg, "cfg", format='png', asminst=True, remove_imports=True)


if __name__ == '__main__':
    cfgfastpng('./01_angr_avoid')

WARNING | 2022-03-01 19:55:43,281 | angr.analyses.cfg.cfg_fast | _tidy_data_references() sees an address 0x80d6040 that does not belong to any section or segment. Traceback (most recent call last): File “/Users/chenyanzhi/Documents/angr/test.py”, line 12, in <module> cfgfastpng(‘./01_angr_avoid’) File “/Users/chenyanzhi/Documents/angr/test.py”, line 8, in cfgfastpng plot_cfg(cfg, “cfg”, format=‘png’, asminst=True, remove_imports=True) File “/Users/chenyanzhi/Desktop/angr-dev/angr-utils/angrutils/visualize.py”, line 34, in plot_cfg vis.process(cfg.graph) File “/Users/chenyanzhi/Desktop/angr-dev/bingraphvis/bingraphvis/base.py”, line 309, in process graph = self.pipeline.process(filter=filter)
File “/Users/chenyanzhi/Desktop/angr-dev/bingraphvis/bingraphvis/base.py”, line 286, in process c.render(n) File “/Users/chenyanzhi/Desktop/angr-dev/bingraphvis/bingraphvis/base.py”, line 126, in render an.annotate_content(n, n.content[self.name]) File “/Users/chenyanzhi/Desktop/angr-dev/bingraphvis/bingraphvis/angr/annotator.py”, line 384, in annotate_content if dr.sort == ‘string’: AttributeError: ‘XRef’ object has no attribute ‘sort’

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mz21gcommented, Mar 3, 2022

Update the following lines in the annotator.py

line 384 : dr.sort 			->>			dr.memory_data.sort
line 385 : dr.insn_addr		->>			dr.memory_data.insn_addr
line 385 : dr.content		->>			str(dr.memory_data.content)

Thank you very much, It works, But I found that the second line should be changed to this

> line 385 : dr.insn_addr		->>			dr.ins_addr

because if I change it like you, It will have the following problems

WARNING | 2022-03-03 22:14:43,965 | angr.analyses.cfg.cfg_fast | _tidy_data_references() sees an address 0x804a040 that does not belong to any section or segment.
Traceback (most recent call last):
  File "/Users/chenyanzhi/Documents/angr/test.py", line 21, in <module>
    cfgfastpng("./00_angr_find")
  File "/Users/chenyanzhi/Documents/angr/test.py", line 16, in cfgfastpng
    plot_cfg(cfg, "cfg", format='png', asminst=True, remove_imports=True)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/angrutils/visualize.py", line 34, in plot_cfg
    vis.process(cfg.graph) 
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bingraphvis/base.py", line 309, in process
    graph = self.pipeline.process(filter=filter)        
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bingraphvis/base.py", line 286, in process
    c.render(n)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bingraphvis/base.py", line 126, in render
    an.annotate_content(n, n.content[self.name])
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bingraphvis/angr/annotator.py", line 385, in annotate_content
    comments_by_addr[dr.memory_data.insn_addr] = str(dr.memory_data.content)
AttributeError: 'MemoryData' object has no attribute 'insn_addr'
0reactions
axtcommented, Mar 13, 2022

I’ve applied the fix and created a new PyPI version. Thanks for the report!

@mz21g Tried your code to test #32, but it creates the assembly listing for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'DataFrame' object has no attribute 'sort' - python
sort () was deprecated for DataFrames in favor of either: sort_values() to sort by column(s); sort_index() to sort by the index.
Read more >
dataframe' object has no attribute 'sort' ( Solved )
The root cause of the error dataframe' has no attribute 'sort' is that you must be using the new version of the pandas...
Read more >
Python 3 issue fix - filter object has no attribute 'sort' #9
Calling the function "apply_encoding_options" using Python3 raise following error: AttributeError: 'filter' object has no attribute 'sort' ...
Read more >
DataFrame object has no attribute sort
Solution for "DataFrame object has no attribute sort". ... Sorting is a process of arranging the data according to our ease. Sorting is...
Read more >
PyMuPDF 1.21.1 documentation - Read the Docs
Method / Attribute ... PDF only: list the keys of object at xref ... FileDataError – if the document has an invalid structure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found