You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the contract I'm investigating as a proof of concept:
contract Test {
function one() external view returns(uint256) {
return 1;
}
// ││ Unicode Comment ││
function two() external view returns(uint256) {
return 2;
}
}
Notice that the four vertical lines of the unicode comment are ascii art box-drawing characters, each is 3 bytes long. This file is therefore 185 characters long and 193 bytes long. (difference of 8 = 4 * (3-1))
cat src/Test.sol | wc -c -m
185 193
This python script:
from crytic_compile import CryticCompile
file = "src/Test.sol"
cc = CryticCompile(file);
for su in cc.compilation_units[file].source_units.items():
print(su[1].srcmaps_runtime)
The first chunk from 0-192 shows that the srcmaps provided by the solc platform are byte-denominated.
Slither encode files as utf8, therefore offsets interpreted as char-denominated.
In particular, this misalignment causes slither-mutate to fail. For example, it will mutate the one function of Test.sol fine, but all mutations after the unicode comment will be off-by-8.
The text was updated successfully, but these errors were encountered:
This is the contract I'm investigating as a proof of concept:
Notice that the four vertical lines of the unicode comment are ascii art box-drawing characters, each is 3 bytes long. This file is therefore 185 characters long and 193 bytes long. (difference of
8 = 4 * (3-1)
)This python script:
prints:
The first chunk from 0-192 shows that the srcmaps provided by the solc platform are byte-denominated.
Slither encode files as
utf8
, therefore offsets interpreted as char-denominated.In particular, this misalignment causes
slither-mutate
to fail. For example, it will mutate theone
function of Test.sol fine, but all mutations after the unicode comment will be off-by-8.The text was updated successfully, but these errors were encountered: