Skip to content
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: generate default-value array expressions using is_inline_array flag s… #33

Merged
merged 1 commit into from
Mar 20, 2023

Conversation

kevinclancy
Copy link

@kevinclancy kevinclancy commented Mar 20, 2023

Notes

Previously, running slither on the following program caused an assertion failure

contract DefaultValueCrashTest {
    struct S {
        uint f;
        uint8[2] g;
    }

    function debug() internal {
        S memory v;
    }
}

This was because the default value generation code produced tuples instead of arrays, causing a list to appear where an rvalue was expected. This PR fixes the default value generation code, so that it correctly produces array expressions (TupleExpressions with the is_inline_array flag set to true) to initialize array fields.

Testing

See this companion PR for testing instructions.

Related Issue

https://github.com/CertiKProject/slither-task/issues/381

@kevinclancy kevinclancy requested a review from duckki March 20, 2023 17:43
@kevinclancy kevinclancy changed the title generate default-value array expressions using is_inline_array flag s… fix: generate default-value array expressions using is_inline_array flag s… Mar 20, 2023
Copy link

@duckki duckki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change makes sense. Thanks.

@duckki duckki merged commit a9f6a95 into certik Mar 20, 2023
@chenhuitao chenhuitao deleted the default-array-fix branch March 18, 2024 10:41
whonore pushed a commit that referenced this pull request May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants