BinExport is raising the following exception when trying to load a binexport file:
Traceback (most recent call last):
File "test.py", line 18, in <module>
main()
File "test.py", line 7, in main
p = qbindiff.Program(qbindiff.LoaderType.binexport, './firmware3v3.bin.BinExport')
File "qbindiff/loader/program.py", line 38, in __init__
self._backend = ProgramBackendBinExport(*args, **kwargs)
File "qbindiff/loader/backend/binexport.py", line 362, in __init__
self.be_prog = binexport.ProgramBinExport(file)
File "binexport/program.py", line 92, in __init__
self[src].children.add(self[dst])
KeyError: 20056
This is due to the filtering done here:
cg = self.proto.call_graph
for node in cg.vertex: # HERE v
if node.address not in self and node.type == cg.Vertex.IMPORTED:
self[node.address] = FunctionBinExport(
weakref.ref(self), is_import=True, addr=node.address
)
if node.address not in self:
continue
Because of the second part of the condition some node (the ones with node.type != IMPORTED) are not added
to the graph but can be later referenced in the callgraph.edge so a fix can be either to check for non existing node when trying to add them in the ProgramBinExport or to simply remove the second part of the check.
The second option result in the following code:
cg = self.proto.call_graph
for node in cg.vertex:
if node.address not in self:
self[node.address] = FunctionBinExport(
weakref.ref(self), is_import=True, addr=node.address
)
BinExport is raising the following exception when trying to load a binexport file:
This is due to the filtering done here:
Because of the second part of the condition some node (the ones with node.type != IMPORTED) are not added to the graph but can be later referenced in the callgraph.edge so a fix can be either to check for non existing node when trying to add them in the ProgramBinExport or to simply remove the second part of the check. The second option result in the following code: