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

Prevent #parse_buffer from altering input buffer #454

Conversation

HosokawaR
Copy link

Fixes #453
This PR prevent #parse_buffer from altering input buffer.

As stated in the issue, it is more intuitive for parse_buffer to not change the input buffer.
However, the internal call Zip::File.open_buffer changes the input buffer if called with block.
Therefore, I changed the calling method so that it does not use block.

@weshatheleopard
Copy link
Owner

You see, I'm temped to NOT do anything about this issue in RubyXL since all that it does is passing the buffer to RubyZip; from that point, it's RubyZip responsebility: if it modifies buffer, it's it's fault, not RubyXLs. I do not appreciate this behavior, as there's no reason why it should ever modify the buffer, but that's what they do.
I figured out that when I pass a String to RubyZip, then .freeze'ing it before passing it over does the trick.
I don't have a problem adding a warning about that to the documentation. But I think RubyZip's issues need to be handled with its developers.

@HosokawaR
Copy link
Author

Thank you for your reply.

it's RubyZip responsebility:

I agree. This PR will be closed for now.

@HosokawaR HosokawaR closed this Apr 8, 2024
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.

#parse_buffer unexpectedly modifies input buffer
2 participants