@@ -176,7 +176,7 @@ def add_stackretencryption_to_function(self,start,ends):
176176
177177 tailp = []
178178 for i ,e in enumerate (ends ):
179- bb_addr = self .patcher .cfg .get_any_node (e ,anyaddr = True ).addr
179+ bb_addr = self .patcher .cfg .model . get_any_node (e ,anyaddr = True ).addr
180180 code = self .add_patch_at_bb (bb_addr ,is_tail = True )
181181 tailp .append (InsertCodePatch (e ,code ,name = "stackretencryption_tail_%d_%d_%#x" % (self .npatch ,i ,start ),priority = 100 ))
182182
@@ -216,7 +216,7 @@ def function_to_patch_locations(self,ff):
216216 return None , None
217217
218218 def is_last_returning_block (self ,node ):
219- node = self .patcher .cfg .get_any_node (node .addr )
219+ node = self .patcher .cfg .model . get_any_node (node .addr )
220220 try :
221221 function = self .patcher .cfg .functions [node .function_address ]
222222 except KeyError :
@@ -227,7 +227,7 @@ def is_last_returning_block(self,node):
227227 return False
228228
229229 def last_block_to_return_locations (self ,addr ):
230- node = self .patcher .cfg .get_any_node (addr )
230+ node = self .patcher .cfg .model . get_any_node (addr )
231231 if node == None :
232232 return []
233233 function = self .patcher .cfg .functions [node .function_address ]
@@ -236,8 +236,8 @@ def last_block_to_return_locations(self,addr):
236236
237237 return_locations = []
238238 for site in self .inv_callsites [function .addr ]:
239- node = self .patcher .cfg .get_any_node (site )
240- nlist = self .patcher .cfg .get_successors_and_jumpkind (node , excluding_fakeret = False )
239+ node = self .patcher .cfg .model . get_any_node (site )
240+ nlist = self .patcher .cfg .model . get_successors_and_jumpkind (node , excluding_fakeret = False )
241241 return_locations .extend ([n [0 ] for n in nlist if n [1 ]== 'Ijk_FakeRet' ])
242242 return return_locations
243243
@@ -264,7 +264,7 @@ def get_reg_free_map(self):
264264 # map all basic block addresses in the function to which regs are read or written
265265 reg_free_map = dict ()
266266 reg_not_free_map = dict ()
267- for n in self .patcher .cfg .nodes ():
267+ for n in self .patcher .cfg .model . nodes ():
268268
269269 if self .patcher .project .is_hooked (n .addr ):
270270 continue
@@ -302,7 +302,7 @@ def get_reg_free_map(self):
302302
303303 def get_all_succ (self ,addr ):
304304 cfg = self .patcher .cfg
305- all_nodes = cfg .get_all_nodes (addr )
305+ all_nodes = cfg .model . get_all_nodes (addr )
306306 if len (all_nodes ) != 1 :
307307 raise CfgError ()
308308 n = all_nodes [0 ]
@@ -312,7 +312,7 @@ def get_all_succ(self,addr):
312312 return [n .addr for n in self .last_block_to_return_locations (addr )], False
313313
314314 all_succ = set ()
315- for s , jk in cfg .get_successors_and_jumpkind (n ):
315+ for s , jk in cfg .model . get_successors_and_jumpkind (n ):
316316 if not jk .startswith ("Ijk_Sys" ):
317317 all_succ .add (s .addr )
318318 # a syscall writes in eax, I do not handle it explicitly
@@ -370,7 +370,8 @@ def _func_is_safe(self, ident, func):
370370 return True
371371
372372 # skip functions that have enough predecessors
373- if len (self .patcher .cfg .get_predecessors (self .patcher .cfg .get_any_node (func .addr ))) > self .safe_calls_limit :
373+ predecessors = self .patcher .cfg .model .get_predecessors (self .patcher .cfg .model .get_any_node (func .addr ))
374+ if len (predecessors ) > self .safe_calls_limit :
374375 return True
375376
376377 is_safe = True
0 commit comments