crytic / crytic/slither

Invalid detection of use after delete

Open
#602 1 comment 0 reactions 0 assignees View on GitHub
0.7 private-detectors
Dominant language
Python
Stars
6.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Please consider the following code using libraries:
```
function cleanupTickets(Storage storage self) internal {
delete self.tickets;
self.tail = 0;
}
```

`use-after-delete` detector reports:
> Using values of variables after they have been explicitly deleted may lead to unexpected behavior or compromise
>
> GroupSelection.cleanupTickets(GroupSelection.Storage) uses a variable after it was deleted
> - Delete: delete self.tickets
> - Use: self.tail = 0

I think the detector is wrong, and it's looking only at `self` part of the line. We are deleting `self.tickets` and `self.tail` can be safely used.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.