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

buffer,lib: update atob to align wpt's base64.json #43901

Closed
wants to merge 6 commits into from

Conversation

XadillaX
Copy link
Member

@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. needs-ci PRs that need a full CI run. labels Jul 19, 2022
Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to remove the equal signs from the string, couldn't we simply count them and throw if there's more than two or if a different char after the first equal sign?

lib/buffer.js Show resolved Hide resolved
lib/buffer.js Outdated Show resolved Hide resolved
lib/buffer.js Outdated Show resolved Hide resolved
lib/buffer.js Outdated Show resolved Hide resolved
lib/buffer.js Outdated Show resolved Hide resolved
@@ -1277,13 +1280,36 @@ function atob(input) {
// The first 5 elements of `kForgivingBase64AllowedChars` are
// ASCII whitespace char codes.
nonAsciiWhitespaceCharCount++;

if (index === kEqualSignIndex) {
Copy link
Contributor

@aduh95 aduh95 Jul 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you put this check here, you don't need to repeat the throw lazyDOMException part, right?

Suggested change
if (index === kEqualSignIndex) {
if (index === kEqualSignIndex && equalCharCount !== 2) {

Other than that, LGTM

@aduh95 aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 30, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 30, 2022
@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot
Copy link
Contributor

@XadillaX
Copy link
Member Author

XadillaX commented Oct 9, 2022

Landed in 3a7fcdc

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. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants