Skip to content

Commit 1fee390

Browse files
committed
add xpo-predicate for trusted-os-cmd-fmt-arg-string
1 parent acac45f commit 1fee390

3 files changed

Lines changed: 35 additions & 3 deletions

File tree

chb/app/CHVersion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
chbversion: str = "0.3.0-20260610"
1+
chbversion: str = "0.3.0-20260611"
22

3-
minimum_required_chb_version = "0.6.0_20260610"
3+
minimum_required_chb_version = "0.6.0_20260611"

chb/app/FnProofObligations.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ def __str__(self) -> str:
159159
+ str(self.xpo)
160160
+ " ("
161161
+ str(self.status)
162+
+ m
162163
+ ")")
163164

164165

@@ -192,7 +193,7 @@ def proofobligations(self) -> Dict[str, List[ProofObligation]]:
192193
xstatus = xxpo.find("status")
193194
if xstatus is not None:
194195
status = POStatus(self.xpod, xstatus)
195-
msg = xxpo.get("m", "none")
196+
msg = xstatus.get("m", "none")
196197
po = ProofObligation(iaddr, xpo, status, msg)
197198
self._store[iaddr].append(po)
198199
return self._store

chb/app/XPOPredicate.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,37 @@ def __str__(self) -> str:
953953
+ ")")
954954

955955

956+
@xporegistry.register_tag("tfa", XPOPredicate)
957+
class XPOTrustedOsCmdFmtArgString(XPOPredicate):
958+
"""Expression is trusted as argument for a format string-constructed command.
959+
960+
args[0]: index of expression in xprdictionary
961+
"""
962+
963+
def __init__(
964+
self, xpod: "FnXPODictionary", ixval: IndexedTableValue) -> None:
965+
XPOPredicate.__init__(self, xpod, ixval)
966+
967+
@property
968+
def is_xpo_trusted_os_cmd_fmt_arg_string(self) -> bool:
969+
return True
970+
971+
@property
972+
def expr(self) -> "XXpr":
973+
return self.xd.xpr(self.args[0])
974+
975+
@property
976+
def optlen(self) -> Optional["XXpr"]:
977+
if self.args[1] == -1:
978+
return None
979+
return self.xd.xpr(self.args[1])
980+
981+
def __str__(self) -> str:
982+
return (
983+
"trusted-os-cmd-fmt-arg-string("
984+
+ str(self.expr))
985+
986+
956987
@xporegistry.register_tag("v", XPOPredicate)
957988
class XPOValidMem(XPOPredicate):
958989
"""Expression points to valid memory.

0 commit comments

Comments
 (0)