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 #994 #995

Merged
merged 1 commit into from
Jan 28, 2021
Merged

Fix #994 #995

merged 1 commit into from
Jan 28, 2021

Conversation

geieredgar
Copy link
Contributor

Changes PartialData::decode to copy at most len bytes.
Changes PartialData::decode_data to copy at most buf.remaining() bytes.

@djc
Copy link
Member

djc commented Jan 28, 2021

Wow, thanks for looking into this! I'd like to merge this to unblock the ability to benchmark #991, but at the same time I don't yet feel that I understand why the changes in 51685fb broke this scenario; the changes to PartialData there are pretty limited, so I wonder if the actual issue might be something else. Therefore I'm probably going to reopen the issue after merging this -- if you want to help out by debugging this more, that would be awesome!

Before we merge this, would you mind just fixing up the first line of the commit message? Would be nice if that was a bit more descriptive (for example, I would probably write it like "quinn-h3: limit amount of data decoded (fixes #994)"). (Personally I think the other lines can be scrapped, since I feel they don't add much explanatory value beyond the actual code changes.)

@geieredgar
Copy link
Contributor Author

OK, I adjusted the commit message.

@djc djc merged commit 30c09d5 into quinn-rs:main Jan 28, 2021
@djc
Copy link
Member

djc commented Jan 28, 2021

Thanks!

@geieredgar
Copy link
Contributor Author

@djc If I understand it correctly, the previously used buf.take(self.remaining).to_bytes() was already limited to buf.remaining() because of how the take method works. I added the first line to prevent errors if buf was larger than len, but I assume that case does not occur.

@djc
Copy link
Member

djc commented Jan 28, 2021

Huh, I guess you're right -- and I was just thrown off by the first part of your change. However, I'm not quite comfortable with saying "that case does not occur", so if it works without that change maybe we could revert that part?

@geieredgar
Copy link
Contributor Author

Huh, I guess you're right -- and I was just thrown off by the first part of your change. However, I'm not quite comfortable with saying "that case does not occur", so if it works without that change maybe we could revert that part?

I'm sorry, I should have clarified that up front. I opened a new PR to revert the first part here: #997.

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