Skip to content

Conversation

@seishun
Copy link
Contributor

@seishunseishun 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-botnodejs-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
@seishunseishun requested review from addaleax and aqrlnJune 13, 2017 15:34
@mscdex
Copy link
Contributor

@seishun
Copy link
ContributorAuthor

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

@seishunseishun changed the title buffer: fix decoding base64 with whitespacesrc: fix decoding base64 with whitespaceJun 14, 2017
@seishunseishun 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
ContributorAuthor

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
ContributorAuthor

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.

@seishunseishun closed this Jun 16, 2017
@seishunseishun merged commit 64812f5 into nodejs:masterJun 16, 2017
@seishunseishun 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: #13660Fixes: #13636Fixes: #13657 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
@addaleaxaddaleax 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: #13660Fixes: #13636Fixes: #13657 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
@addaleaxaddaleax mentioned this pull request Jun 21, 2017
@MylesBorins
Copy link
Contributor

Should this be backported to v6.x?

@seishun
Copy link
ContributorAuthor

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

@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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bufferIssues and PRs related to the buffer subsystem.c++Issues and PRs that require attention from people who are familiar with C++.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

base64 decoding drops characters when there is whitespace in the middle Making base64 cctest deterministic makes it fail

8 participants

@seishun@mscdex@addaleax@MylesBorins@aqrln@jasnell@cjihrig@nodejs-github-bot