[文档]classMemoryLoadResolver(IndirectJumpResolver):""" Resolve an indirect jump that looks like the following:: .text: call off_3314A8 .data: off_3314A8 dd offset sub_1E426F This indirect jump resolver may not be the best solution for all cases (e.g., when the .data section can be intentionally altered by the binary itself). """
[文档]defresolve(# pylint:disable=unused-argumentself,cfg,addr:int,func_addr:int,block:pyvex.IRSB,jumpkind:str,func_graph_complete:bool=True,**kwargs,):""" :param cfg: CFG with specified function :param addr: Address of indirect jump :param func_addr: Address of function of indirect jump :param block: Block of indirect jump (Block object) :param jumpkind: VEX jumpkind (Ijk_Boring or Ijk_Call) :return: Bool tuple with replacement address """vex_block=blockifisinstance(vex_block.next,pyvex.expr.RdTmp):tmp_stmt_idx,tmp_ins_addr=self._find_tmp_write_stmt_and_ins(vex_block,vex_block.next.tmp)iftmp_stmt_idxisNoneortmp_ins_addrisNone:returnFalse,[]stmt=vex_block.statements[tmp_stmt_idx]assertisinstance(stmt,pyvex.IRStmt.WrTmp)if(isinstance(stmt.data,pyvex.IRExpr.Load)andisinstance(stmt.data.addr,pyvex.IRExpr.Const)andstmt.data.result_size(vex_block.tyenv)==self.project.arch.bits):load_addr=stmt.data.addr.con.valuetry:value=self.project.loader.memory.unpack_word(load_addr,size=self.project.arch.bytes)ifisinstance(value,int)andself._is_target_valid(cfg,value):returnTrue,[value]exceptKeyError:returnFalse,[]returnFalse,[]