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 in gzipstreamfile #84

Closed
jfoster17 opened this issue Jul 27, 2016 · 3 comments
Closed

Bug in gzipstreamfile #84

jfoster17 opened this issue Jul 27, 2016 · 3 comments
Assignees
Labels

Comments

@jfoster17
Copy link

I ran into a bug while trying to stream a fairly large line of data from a gzipped S3 file. Basically:

if len(self.unused_buffer) > size:
    return self.read_from_buffer()

is an incorrect call of read_from_buffer, which needs to have the argument size. I think the correct fix is as simple as:

if len(self.unused_buffer) > size:
    return self.read_from_buffer(size)

This seems to work in my particular case. Not 100% sure this is the generally correct solution, which if why I'm posting this issue rather than making a PR.

@mpenkov
Copy link
Collaborator

mpenkov commented Jul 30, 2016

@jfoster17 I can see that the problem is that the statement returns the full contents of the buffer, meaning the read function could theoretically return more bytes than requested. Your proposed solution seems reasonable, but could you be a bit more specific: how did the bug manifest itself in your case? Was it an exception of some sort?

The reason I ask is that I'm trying to reproduce the problem in a unit test, and haven't been able to trigger the problem condition so far.

@mpenkov
Copy link
Collaborator

mpenkov commented Jul 31, 2016

@jfoster17 Never mind, I reproduced the problem and am working on the fix.

@tmylk
Copy link
Contributor

tmylk commented Sep 18, 2016

Fixed in eba107f

@tmylk tmylk closed this as completed Sep 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants