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

Fix GzipWriter output #3421

Merged
merged 2 commits into from Nov 3, 2015
Merged

Fix GzipWriter output #3421

merged 2 commits into from Nov 3, 2015

Conversation

dmarcotte
Copy link
Contributor

GZIPOutputStream was passing one of its internal byte buffers to IOOutputStream#write, which in turn used those bytes to back the ByteList for its output. So every subsequent time GZIPOutputStream wrote to that buffer, it overwrote the bytes behind the back of all the previous chunks of output.

Ensure that IOOutputStream is working on a copy of the bytes it gets from GZIPOutputStream to fix this issue.

Fixes #1371

Let me know if there's any questions, and thanks again!

GZIPOutputStream was passing one of its internal byte buffers to
IOOutputStream#write, which in turn used those bytes to back the
ByteList for its output.  So every subsequent time GZIPOutputStream
wrote to that buffer, it overwrote the bytes behind the back of all
the previous chunks of output.

Ensure that IOOutputStream is working on a copy of the bytes
it gets from GZIPOutputStream to fix this issue.
Typo'ed variable reference should have caused problems, but got lucky
and the only place calling this `write` passes 0 for `off` so everything
just happens to always work in spite of looking so, so wrong.
@dmarcotte
Copy link
Contributor Author

Just pushed a small extra change on this pull: b2dc3da. Apologies for the noise.

@dmarcotte
Copy link
Contributor Author

Just saw Travis is showing red on this pull because the 1_7 branch went red while I was working on this. See here for a green run of these changes: https://travis-ci.org/dmarcotte/jruby/builds/87085859

@kares kares added this to the JRuby 1.7.23 milestone Nov 3, 2015
kares added a commit that referenced this pull request Nov 3, 2015
@kares kares merged commit a7f8715 into jruby:jruby-1_7 Nov 3, 2015
@kares
Copy link
Member

kares commented Nov 3, 2015

☝️ very najs find - much appreciated!

@dmarcotte
Copy link
Contributor Author

Thanks @kares!

@dmarcotte dmarcotte deleted the test-gzip-fix branch November 6, 2015 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants