Skip to content

Commit

Permalink
Improve error messages in pointer-to-bitvector casts in string operat…
Browse files Browse the repository at this point in the history
…ions

Co-authored-by: Ryan Scott <[email protected]>
  • Loading branch information
langston-barrett and RyanGlScott authored Jul 12, 2024
1 parent 6af2c59 commit a3241a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crucible-llvm/src/Lang/Crucible/LLVM/MemModel.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ strLen bak mem = go (BV.zero PtrWidth) (truePred sym)
do ast <- impliesPred sym cond loadok
assert bak ast $ AssertFailureSimError "Error during memory load: strlen" ""
v <- unpackMemValue sym (LLVMPointerRepr (knownNat @8)) llvmval
let err = AssertFailureSimError "Found pointer in string passed to `strlen`" ""
let err = AssertFailureSimError "Found pointer instead of byte in string passed to `strlen`" ""
test <- bvIsNonzero sym =<< Partial.ptrToBv bak err v
iteM bvIte sym
test
Expand Down Expand Up @@ -1172,7 +1172,7 @@ loadString bak mem = go id
go f _ (Just 0) = return $ f []
go f p maxChars = do
v <- doLoad bak mem p (bitvectorType 1) (LLVMPointerRepr (knownNat :: NatRepr 8)) noAlignment
let err = AssertFailureSimError "Found pointer when loading string" ""
let err = AssertFailureSimError "Found pointer instead of byte when loading string" ""
x <- Partial.ptrToBv bak err v
case BV.asUnsigned <$> asBV x of
Just 0 -> return $ f []
Expand Down

0 comments on commit a3241a4

Please sign in to comment.