Skip to content

Fix AbstractInputStream#gets to not assume a_sep_string will appear…#662

Open
ListlessPanda wants to merge 1 commit intorubyzip:2.3from
ListlessPanda:2.3-abstractinputstream-separator-not-within-number-of-bytes
Open

Fix AbstractInputStream#gets to not assume a_sep_string will appear…#662
ListlessPanda wants to merge 1 commit intorubyzip:2.3from
ListlessPanda:2.3-abstractinputstream-separator-not-within-number-of-bytes

Conversation

@ListlessPanda
Copy link
Copy Markdown

The AbstractInputStream#gets has logic to check if the number of bytes within the @output_buffer are over the limit then sets over_limit. It seems that if a separator was passed in along with the number of bytes the code assumes the separator will appear within the bytes read.

This was picked up when streaming a CSV out of a ZIP where the CSV passes the a_sep_string as \n and the number of bytes as 8192 and the file contains a single column value that is longer than 8192 bytes

I made a change that if the separator wasn't found and we are above the limit it will return up to the number of bytes and increase the @pos by that amount.

(This is my first pull request please let me know if I need to do anything else)

… within the bytes that are being limited by `number_of_bytes`
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.

1 participant