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

[MemMapFs] Check for getting nil mem.FileData by key #421

Open
nd-cyberprotect opened this issue Mar 27, 2024 · 0 comments
Open

[MemMapFs] Check for getting nil mem.FileData by key #421

nd-cyberprotect opened this issue Mar 27, 2024 · 0 comments

Comments

@nd-cyberprotect
Copy link

nd-cyberprotect commented Mar 27, 2024

About v.1.11.0.

Static analysis shows two critical:

  1. After having been assigned to a nil value at memmap.go:240, pointer '&parent.Mutex' is passed as implicit 'this' parameter in call to function 'sync.Mutex.Lock' at memmap.go:131, where it is dereferenced at mutex.go:16.

  2. After having been assigned to a nil value at memmap.go:240, pointer 'f' is passed as 1st parameter in call to function 'afero.MemMapFs.findParent' at memmap.go:73, where it is dereferenced at memmap.go:85.

It's looks like false positive because an error returns on line 240 that is being handled in methods registerWithParent and unRegisterWithParent. But there is a moment. getData() returns a map that stores pointers and there is no check for getting nil by existed keys in methods lockfreeOpen and open. This potentially may causes panics.

Please add checks for getting nil where they need to be.

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

1 participant