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

uninitialized-local reports false positives for structs #779

Closed
snd opened this issue Jan 25, 2021 · 1 comment
Closed

uninitialized-local reports false positives for structs #779

snd opened this issue Jan 25, 2021 · 1 comment

Comments

@snd
Copy link
Contributor

snd commented Jan 25, 2021

given StructType a common pattern is:

StructType memory structVar;
structVar.a = 1;
structVar.b = "a";

slither reports uninitialized-local for StructType memory structVar in this case.

a useful addition would be to check for each struct field whether it is assigned below before it is read.

alternatively this detector could detect that locals (and storage variables) are initialized before they are read instead of checking that they are initialized in the line they are defined.
this should result in catching all dangerous unintended reads from uninitialized variables while producing less noise.
when handling structs it could treat each field separately.

the same could be done for uninitialized-state.

@montyly
Copy link
Member

montyly commented Feb 1, 2021

Duplicate of #365

@montyly montyly marked this as a duplicate of #365 Feb 1, 2021
@montyly montyly closed this as completed Feb 1, 2021
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

No branches or pull requests

2 participants