Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chb/app/CHVersion.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
chbversion: str = "0.3.0-20251011"
chbversion: str = "0.3.0-20251012"
9 changes: 7 additions & 2 deletions chb/astinterface/ASTICodeTransformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 8 additions & 4 deletions chb/astinterface/ASTIProvenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions chb/astinterface/ASTInterfaceBasicBlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = []

Expand All @@ -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)