Skip to content

Commit

Permalink
Merge pull request #398 from ethereum/fix-copyslice-exception
Browse files Browse the repository at this point in the history
Expr: fix downcast exception in simplify
  • Loading branch information
d-xo authored Oct 2, 2023
2 parents e22d757 + 4f3345c commit 4e4bc8d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/EVM/Expr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,11 @@ simplify e = if (mapExpr go e == e)
-- n+sz of ConcreteBuf will be used by CopySlice
(WriteWord wOff value (ConcreteBuf buf)) dst)
-- Let's not deal with overflow
| n+sz >= n && n+sz >= sz = (CopySlice srcOff dstOff size
(WriteWord wOff value (ConcreteBuf simplifiedBuf)) dst)
| n+sz >= n
, n+sz >= sz
, n+sz <= maxBytes
= (CopySlice srcOff dstOff size
(WriteWord wOff value (ConcreteBuf simplifiedBuf)) dst)
| otherwise = orig
where simplifiedBuf = BS.take (unsafeInto (n+sz)) buf
go (CopySlice a b c d f) = copySlice a b c d f
Expand Down

0 comments on commit 4e4bc8d

Please sign in to comment.