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

Handle zero chunk size #265

Open
wants to merge 1 commit into
base: v15.x
Choose a base branch
from
Open

Conversation

moshaad7
Copy link
Contributor

Backport of #263

The existing implementation of the method
getChunkSize(...) (uint64, error), in some cases,
can return chunkSize==0 and err==nil.

The onus is on the caller to check for such possibility
and handle it properly.
Callers often use the returned chunkSize as a divisor and
a zero chunkSize lead to panic.
see #209

This PR intends to update the method implementation to
always return an error in case the returned chunkSize
value is 0.
That way caller need to only worry about error being non-nil.

Callers which are ok with 0 chunkSize can check the returned
error against ErrChunkSizeZero
@moshaad7 moshaad7 linked an issue Sep 12, 2024 that may be closed by this pull request
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

Successfully merging this pull request may close these issues.

runtime error: integer divide by zero
1 participant