Skip to content

Commit

Permalink
Fix zero-length slice taint bug (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
GNSPS authored Jan 7, 2021
1 parent 889455e commit e470a89
Show file tree
Hide file tree
Showing 3 changed files with 5,860 additions and 21 deletions.
3 changes: 3 additions & 0 deletions contracts/BytesLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ library BytesLib {
//if we want a zero-length slice let's just return a zero-length array
default {
tempBytes := mload(0x40)
//zero out the 32 bytes slice we are about to return
//we need to do it because Solidity does not garbage collect
mstore(tempBytes, 0)

mstore(0x40, add(tempBytes, 0x20))
}
Expand Down
Loading

0 comments on commit e470a89

Please sign in to comment.