Skip to content

Commit

Permalink
Merge pull request #246 from samalws-tob/echCovFixes3
Browse files Browse the repository at this point in the history
Fix off-by-one bug in EVM.Debug.srcMapCodePos
  • Loading branch information
d-xo authored Apr 18, 2023
2 parents 8323757 + d4010ad commit 8af8347
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- The `prank` cheatcode now transfers value from the correct address
- Fixed an off-by-one error in `EVM.Debug.srcMapCodePos`

## [0.50.4] - 2023-03-17

Expand Down
2 changes: 1 addition & 1 deletion src/EVM/Debug.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ srcMapCodePos :: SourceCache -> SrcMap -> Maybe (Text, Int)
srcMapCodePos cache sm =
fmap (second f) $ cache.files ^? ix sm.file
where
f v = ByteString.count 0xa (ByteString.take (sm.offset - 1) v) + 1
f v = ByteString.count 0xa (ByteString.take sm.offset v) + 1

srcMapCode :: SourceCache -> SrcMap -> Maybe ByteString
srcMapCode cache sm =
Expand Down

0 comments on commit 8af8347

Please sign in to comment.