-
Notifications
You must be signed in to change notification settings - Fork 995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug-Candidate]: Source mapping indexes exceed source length when special characters are present in Solidity files #2692
Comments
Hi @nivcertora ! Thanks for the report. If you have some time, could you check if the changes in #2662 improve the situation? From my understanding, the issue stems from the fact that the offsets are in bytes, not "characters" in the string sense, which causes differences when you have multi-byte characters in your source code. |
Thanks for the quick response. Is there an easy way to install the version with the changes? |
You should be able to install it from the PR branch with
|
Did you notice if there's a specific detector that's reporting misaligned source maps? Or are you writing a Python script that checks the Source objects directly? |
Could you use |
Describe the issue:
We are encountering an issue with Slither’s source mapping when analyzing Solidity files that include certain special Unicode characters. In our use case, the source mapping index returned for some functions exceeds the length of the source file. For example, we observed that for a file with a total length of 54,863 characters, Slither reported an internal function with a start index of 55,053.
After investigation, we suspect that the presence of characters such as:
may be causing encoding or processing issues within Slither (or its underlying CryticCompile component), leading to miscalculation of character positions.
Steps to Reproduce:
Test.sol
) that includes a library or contract containing these special characters in comments or string literals.Code example to reproduce the issue:
(https://github.com/Vectorized/solady/blob/main/src/utils/FixedPointMathLib.sol)
Version:
0.11.0
Relevant log output:
The text was updated successfully, but these errors were encountered: