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

[BUG] GetLimitMegabytes check in stow_store.go is incorrect due to integer and float conversion #4368

Closed
2 tasks done
honnix opened this issue Nov 6, 2023 · 0 comments · Fixed by #4370
Closed
2 tasks done
Labels
bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers

Comments

@honnix
Copy link
Member

honnix commented Nov 6, 2023

Describe the bug

if GetConfig().Limits.GetLimitMegabytes != 0 {
if sizeMbs := sizeBytes / MiB; sizeMbs > GetConfig().Limits.GetLimitMegabytes {
return nil, errors.Errorf(ErrExceedsLimit, "limit exceeded. %vmb > %vmb.", sizeMbs, GetConfig().Limits.GetLimitMegabytes)
}
}
, this max size check is incorrect because the division rounds down, which means as long as the sizeBytes is less than GetLimitMegabytes + 1 MB, this is always false.

Expected behavior

The max size check is done correctly.

Additional context to reproduce

No response

Screenshots

No response

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@honnix honnix added bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers labels Nov 6, 2023
@honnix honnix mentioned this issue Nov 6, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant