File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed
Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ def check_first_instruction(instr):
8080 return None
8181
8282 try :
83- succ = ff .startpoint . successors ( )
83+ outedges = ff .transition_graph . out_edges ( ff . startpoint , data = True )
8484 except networkx .NetworkXError :
8585 return None
8686 ends = ff .endpoints
@@ -90,19 +90,21 @@ def check_first_instruction(instr):
9090 return None
9191
9292 if syscall_number == 1 :
93- if len (succ ) == 1 :
94- bb1 = succ [ 0 ]
95- if hasattr ( bb1 , "is_syscall " ) and bb1 . is_syscall :
93+ if len (outedges ) == 1 :
94+ edge_data = list ( outedges )[ 0 ][ - 1 ]
95+ if edge_data . get ( "type " ) == "syscall" :
9696 return syscall_number
9797 return None
9898 else :
9999 if not is_sane_function (ff ):
100100 return None
101- if len (succ ) == 2 :
102- bb1 ,bb2 = succ
103- if hasattr (bb1 ,"is_syscall" ) and bb1 .is_syscall :
101+ if len (outedges ) == 2 :
102+ outedges = list (outedges )
103+ _ , bb1 , data1 = outedges [0 ]
104+ _ , bb2 , data2 = outedges [1 ]
105+ if data1 .get ("type" ) == "syscall" :
104106 ebb = bb2
105- elif hasattr ( bb2 , "is_syscall " ) and bb2 . is_syscall :
107+ elif data2 . get ( "type " ) == "syscall" :
106108 ebb = bb1
107109 else :
108110 ebb = None
Original file line number Diff line number Diff line change @@ -261,7 +261,7 @@ def test_detect_syscall_wrapper():
261261 syscall_wrappers = set ([(ff .addr ,cfg_utils .detect_syscall_wrapper (backend ,ff )) \
262262 for ff in cfg .functions .values () if cfg_utils .detect_syscall_wrapper (backend ,ff )!= None ])
263263 print ("syscall wrappers in CROMU_00071:" )
264- print (map (lambda x :(hex (x [0 ]),x [1 ]),syscall_wrappers ))
264+ print (list ( map (lambda x :(hex (x [0 ]),x [1 ]),syscall_wrappers ) ))
265265 assert syscall_wrappers == legitimate_syscall_wrappers
266266
267267 filepath = os .path .join (bin_location , "CROMU_00070" )
@@ -280,7 +280,7 @@ def test_detect_syscall_wrapper():
280280 syscall_wrappers = set ([(ff .addr ,cfg_utils .detect_syscall_wrapper (backend ,ff )) \
281281 for ff in cfg .functions .values () if cfg_utils .detect_syscall_wrapper (backend ,ff )!= None ])
282282 print ("syscall wrappers in CROMU_00070:" )
283- print (map (lambda x :(hex (x [0 ]),x [1 ]),syscall_wrappers ))
283+ print (list ( map (lambda x :(hex (x [0 ]),x [1 ]),syscall_wrappers ) ))
284284 assert syscall_wrappers == legitimate_syscall_wrappers
285285
286286
You can’t perform that action at this time.
0 commit comments