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

Possibility of DB corruption #1

Open
kshpytsya opened this issue Nov 23, 2023 · 0 comments
Open

Possibility of DB corruption #1

kshpytsya opened this issue Nov 23, 2023 · 0 comments

Comments

@kshpytsya
Copy link

Since it is perfectly acceptable for open to return 0 ("The return value of open() is a file descriptor, a small, nonnegative integer" 1), self.fd may be set to 0 in the following line:

self.fd = os.open(self.path, os.O_RDONLY)

This is highly possible in non-interactive Docker environment, when there is no stdin open.

Incorrect condition in the following line (which should be written as self.fd is not None instead):

if self.fd:

causes wiping of the DB via self._create_empty_db call.

Footnotes

  1. man open

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