forked from crytic/slither
-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix: Make IR set type of reference to popped element correctly #43
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* feat: populate the source location of using_for construct to facilitate https://github.com/CertiKProject/slither-task/issues/71
…able's type_specific_fields
* The error started appearing after commit f9a3568. https://github.com/CertiKProject/slither-task/issues/71
* populate a boolean flag in the Contract AST during solc AST parsing
- changed `kind` to `contract_kind` and used source_mapping.to_json(). https://github.com/CertiKProject/slither-task/issues/171
* assign catch parameters to calls to certik_unknown_*typename* functions https://github.com/CertiKProject/slither-task/issues/188 https://github.com/CertiKProject/slither-task/issues/190
* create two parsers and compilation units: one using the new certik ir and the other using slithir https://github.com/CertiKProject/slither-task/issues/217
* only generate default values for variables with 'memory' and 'default' location check that the type of variable is LocalVariable instead of using a _from_statement variable https://github.com/CertiKProject/slither-task/issues/200
…21) * add implicit initialization for return variables * only assign default return value if location is memory (or default) * add implicit return statement if they are missing
Previously, all detectors were incorrectly receiving certik ir because the uses_certik_ir property was being read from the detector class as a "truthy" function. This PR fixes the issue by changing uses_certik_ir to a static method.
…ecting condition node to false-statement node (#23) - fixes the issue with wrong if-statement CFG when the then-clause is empty. https://github.com/CertiKProject/slither-task/issues/241
…e array and generate SlithIR accordingly (#26) CertiKProject/slither-task#212
… correct post-loop-body expression (#27) https://github.com/CertiKProject/slither-task/issues/285
added pipfile
https://github.com/CertiKProject/slither-task/issues/327 * feat: add constant folding to IR * added certik ir flag to SlitherCompilationUnit
…d use it as the offset of default initializers, if any (#32) https://github.com/CertiKProject/slither-task/issues/343
…gnized as strings (#35)
…default value of the underlying type. (#36) https://github.com/CertiKProject/slither-task/issues/390
- since we have our own solution (/pull/26) https://github.com/CertiKProject/slither-task/issues/383
- If `has_receiver_arg` is true, the call was resolved via using-for and has a receiver object expression as its first argument.
* push takes an optional element-to-push https://github.com/CertiKProject/slither-task/issues/461
* fixed structure of convert_to_structure_to_list function https://github.com/CertiKProject/slither-task/issues/508
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Notes
The IR generated for calls to pop (for dynamic array types and
bytes
) would obtain a reference to the last element of the array and then delete it. But the type of this reference was alwaysuint256
even though it should have been the type of the array element.Now, we set the reference's type to the array element type. For
bytes
, we set the reference's type tobytes1
.Trail o' Bits developed a fix for this, but I think they used the wrong element type for
bytes
. It should bebytes1
but they usebytes
. I will file an issue with them about this.Testing
make test
and verify all tests succeed../evaluate.sh run 100
intool-eval
and verify all projects succeedpipenv run slither test.sol --print slithir
, wheretest.sol
contains the following:Examine the IR and verify that the deleted reference variable has the correct type. Also, try changing the array
a
's type tobytes
.Related Issue
https://github.com/CertiKProject/slither-task/issues/501)
Additional Comments
I will file an issue in the Slither repo about handling
bytes
incorrectly.