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 slither-read-storage crash when a structure has only other structs as fields #2666

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

smonicas
Copy link
Collaborator

Fix a crash when a struct has only other structs. The size variable would not be initialized.

contract T {
  struct A {
   uint256 value;
  }

  struct T {
   A _inner;
  }

  T _t;
}
  File ".../slither/tools/read_storage/read_storage.py", line 597, in _find_struct_var_slot
    return info, type_to, slot_as_bytes, size, offset
                                         ^^^^
UnboundLocalError: cannot access local variable 'size' where it is not associated with a value

@smonicas smonicas requested a review from montyly as a code owner February 17, 2025 11:58
@smonicas smonicas merged commit 88fdafb into dev Feb 21, 2025
46 checks passed
@smonicas smonicas deleted the dev-fix-slither-read-storage branch February 21, 2025 13:58
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.

1 participant