-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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 integer overflow on 32-bit systems when testing free space for wr… #36759
Conversation
cc @come-nc since you have a bit experience with 32-bit: what would be the best approach to fix this? Is checking against float even possible? |
Just ran into the same issue on beta 4 upgrade. Removing |
Psalm complains without... |
You mean if not both are int or both are float? Then we need to cast both to float before comparing (as on 64-bit free space will usually be int?), doing the same in all other cases where numerical values are compared which can be >2 GiB. How was such done before the temporary decision to drop 32-bit support? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not even sure why a cast is needed, what does psalm complains about without it?
…iting a config file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine by me then
Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 |
Still not sure why we cast the config file size to float now? |
…iting a config file.
Summary
This trivial commit fixes integer overflow on 32-bit systems when trying to write back config.php on upgrade.
The bug is introduced recently, in commit 9b6e5c6