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

Off by one error when reading chunks #56

Merged
merged 2 commits into from
Mar 9, 2015

Conversation

mhoglan
Copy link
Contributor

@mhoglan mhoglan commented Mar 7, 2015

Addresses:
#55

mhoglan added 2 commits March 6, 2015 16:53
Remove the -1 occurring when checking if the current index (cIdx) was equal or greater than size of chunk (rChunk.size) being processed.  Both values are 1-based and there should not be the need to offset the size by 1;  cIdx starts at 0 initially, but is replaced by number of bytes read which is 1-based as it is a count and not an index into the range of bytes being read.
Add guard to handle if bytesRead is greater than content-length.  Should not occur as golang uses a LimitedReader up to the content-length, but if for some reason the bytesRead was greater than content-length, the getter will hang as it keeps trying to read the nextChunk (which does not exist)
@rlmcpherson
Copy link
Owner

Good find, thanks for the fix! Looks like the OBOE was introduced by the slicePool changes.

rlmcpherson added a commit that referenced this pull request Mar 9, 2015
Off by one error when reading chunks
@rlmcpherson rlmcpherson merged commit 3981d2a into rlmcpherson:master Mar 9, 2015
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.

2 participants