diff --git a/chb/app/CHVersion.py b/chb/app/CHVersion.py index 94759afc..4f472907 100644 --- a/chb/app/CHVersion.py +++ b/chb/app/CHVersion.py @@ -1 +1 @@ -chbversion: str = "0.3.0-20251011" +chbversion: str = "0.3.0-20251012" diff --git a/chb/astinterface/ASTICodeTransformer.py b/chb/astinterface/ASTICodeTransformer.py index 76b94c2c..fa262604 100644 --- a/chb/astinterface/ASTICodeTransformer.py +++ b/chb/astinterface/ASTICodeTransformer.py @@ -72,8 +72,13 @@ def transform_block_stmt(self, stmt: AST.ASTBlock) -> AST.ASTStmt: for s in stmt.stmts: newstmt = s.transform(self) # prune empty blocks that may have been created by the pruning - # of redundant if statements - if newstmt.is_ast_block and len((cast(AST.ASTBlock, newstmt)).stmts) == 0: + # of redundant if statements. + # StmtLabels may be intermixed with statements, hence the check + # for is_stmt_label. + if ( + not newstmt.is_stmt_label + and newstmt.is_ast_block + and len((cast(AST.ASTBlock, newstmt)).stmts) == 0): continue newstmts.append(newstmt) diff --git a/chb/astinterface/ASTIProvenance.py b/chb/astinterface/ASTIProvenance.py index 838c7851..511049f7 100644 --- a/chb/astinterface/ASTIProvenance.py +++ b/chb/astinterface/ASTIProvenance.py @@ -426,6 +426,8 @@ def resolve_reaching_defs(self) -> None: for rd in rds: rd = cast("ReachingDefFact", rd) v = str(rd.variable) + if v == "PC": + continue addrs = [str(d) for d in rd.deflocations] for addr in addrs: if addr == "init": @@ -459,10 +461,12 @@ def resolve_reaching_defs(self) -> None: + "not found", str(v)) else: - chklogger.logger.warning( - "Reaching definition address %s for variable %s " - + " not found", - str(addr), str(v)) + # temporarily silence warnings for payload addresses + if not addr.startswith("F"): + chklogger.logger.warning( + "Reaching definition address %s for variable %s " + + " not found", + str(addr), str(v)) def resolve_flag_reaching_defs(self) -> None: diff --git a/chb/astinterface/ASTInterfaceBasicBlock.py b/chb/astinterface/ASTInterfaceBasicBlock.py index 394babb6..f59181a7 100644 --- a/chb/astinterface/ASTInterfaceBasicBlock.py +++ b/chb/astinterface/ASTInterfaceBasicBlock.py @@ -542,6 +542,11 @@ def trampoline_takedown_ast(self, astree: "ASTInterface") -> AST.ASTStmt: raise UF.CHBError("Internal error") return self.trampoline_block_ast("fallthrough", astree) + def trampoline_continue_ast(self, astree: "ASTInterface") -> AST.ASTStmt: + if not self.is_trampoline: + raise UF.CHBError("Internal error") + return self.trampoline_block_ast("continuepath", astree) + def trampoline_ast(self, astree: "ASTInterface") -> AST.ASTStmt: stmts: List[AST.ASTStmt] = [] @@ -562,4 +567,6 @@ def trampoline_ast(self, astree: "ASTInterface") -> AST.ASTStmt: str(len(self.trampoline_payload_roles))) if "fallthrough" in self.trampoline: stmts.append(self.trampoline_takedown_ast(astree)) + if "continuepath" in self.trampoline: + stmts.append(self.trampoline_continue_ast(astree)) return astree.mk_block(stmts)