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

src: fix decoding base64 with whitespace #13660

Merged
merged 0 commits into from
Jun 16, 2017
Merged

src: fix decoding base64 with whitespace #13660

merged 0 commits into from
Jun 16, 2017

Conversation

seishun
Copy link
Contributor

@seishun seishun commented Jun 13, 2017

max_i should also include the characters that were just read by
base64_decode_group_slow.

Fixes: #13636
Fixes: #13657

Please do review the commit message as well.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

buffer

@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. labels Jun 13, 2017
@seishun seishun requested review from addaleax and aqrln June 13, 2017 15:34
@mscdex
Copy link
Contributor

mscdex commented Jun 13, 2017

@seishun
Copy link
Contributor Author

seishun commented Jun 14, 2017

I've replaced "buffer" with "src" in the commit message since this code isn't used just for the buffer module. Any objections?

@seishun seishun changed the title buffer: fix decoding base64 with whitespace src: fix decoding base64 with whitespace Jun 14, 2017
@seishun seishun mentioned this pull request Jun 14, 2017
2 tasks
@addaleax
Copy link
Member

Sorry for being so late – can you also include the patch from #13636?

@seishun
Copy link
Contributor Author

seishun commented Jun 16, 2017

I'm having reservations about including it here, it seems barely related, and would probably confuse someone looking at the commit.

Besides, that patch isn't a proper fix for the test since null char is a valid byte. The right thing would be to compare the decoded length with the expected length.

@addaleax
Copy link
Member

I'm having reservations about including it here, it seems barely related, and would probably confuse someone looking at the commit.

You can totally include it as a separate commit, if that helps. (If you don’t want to include it, fine by me – but we should fix the test in any case.)

Besides, that patch isn't a proper fix for the test since null char is a valid byte.

Right, good point. I’d be okay with accepting that because our expected texts don’t contain null chars, but if you have reservations I can do a PR myself.

@seishun
Copy link
Contributor Author

seishun commented Jun 16, 2017

because our expected texts don’t contain null chars

Right, they don't, but what if our base64_decode implementation starts erroneously padding its output with nulls? The test should fail then.

I can do a PR myself.

That would be great.

@seishun seishun closed this Jun 16, 2017
@seishun seishun merged commit 64812f5 into nodejs:master Jun 16, 2017
@seishun seishun deleted the fix-base64 branch June 16, 2017 16:11
addaleax pushed a commit that referenced this pull request Jun 17, 2017
`max_i` should also include the characters that were just read by
`base64_decode_group_slow()`.

PR-URL: #13660
Fixes: #13636
Fixes: #13657
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@addaleax addaleax mentioned this pull request Jun 17, 2017
addaleax pushed a commit that referenced this pull request Jun 21, 2017
`max_i` should also include the characters that were just read by
`base64_decode_group_slow()`.

PR-URL: #13660
Fixes: #13636
Fixes: #13657
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@addaleax addaleax mentioned this pull request Jun 21, 2017
@MylesBorins
Copy link
Contributor

Should this be backported to v6.x?

@seishun
Copy link
Contributor Author

seishun commented Jul 17, 2017

If it applies cleanly, then yes.

@addaleax
Copy link
Member

addaleax commented Jul 18, 2017

If not, we should probably still backport the test piece here. (edit: to be clear, that passes on its own on 6.11.1)

@aqrln
Copy link
Contributor

aqrln commented Jul 21, 2017

@MylesBorins this PR fixes a bug introduced in #12146, so it depends on whether that patch was backported or not.

@MylesBorins
Copy link
Contributor

opted to not land, please feel free to manually backport the test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++.
Projects
None yet
8 participants