-
Notifications
You must be signed in to change notification settings - Fork 116
Issue 821 #823
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
Conversation
"base64 decoding with stop_before_partial returning OUTPUT_BUFFER_IS_TOO_SMALL for illegal padded chunk" The issue was reported by Shu-yu Guo. The fix in this commit is quite simple and involves adding a missing test. It also adds more tests and fixes some typos in the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses issue #821 by adding missing tests for padded-base64 handling, strengthening error checks in decoding implementations, and correcting typos in documentation.
- Introduce a
std::stringoverload ofadd_simple_spacesand add TC39-based tests for illegal padded chunks. - Add guards in scalar and Ice Lake implementations to reject invalid padding lengths.
- Fix spelling (“taylor” → “tailor”) and expand the README with detailed WHATWG forgiving-base64 documentation.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/base64_tests.cpp | Added string version of add_simple_spaces, new padded-chunk tests, and removed outdated test |
| src/scalar/base64.h | Added check to reject cases where idx + padding_characters > 4 |
| src/icelake/icelake_base64.inl.cpp | Duplicated the invalid-padding-length guard for Ice Lake backend |
| include/simdutf/implementation.h | Fixed “taylor” → “tailor” typos in documentation comments |
| README.md | Expanded WHATWG forgiving-base64 section; corrected grammar and typos |
Comments suppressed due to low confidence (1)
README.md:1848
- [nitpick] Grammar issue: change 'We also converting from' to 'We also convert from' or 'We also support converting from'.
We also converting from [WHATWG forgiving-base64](https://infra.spec.whatwg.org/#forgiving-base64-decode) to binary, and back. In particular, you can convert base64 inputs which contain ASCII spaces (' ', '\t', '\n', '\r', '\f') to binary. We also support the base64 URL encoding alternative. These functions are part of the Node.js JavaScript runtime: in particular `atob` in Node.js relies on simdutf.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| ASSERT_EQUAL(back, expected); | ||
| } | ||
|
|
||
| // https://github.com/tc39/test262 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I will fix in a pre-release commit.
Fixes #821
The issue was reported by Shu-yu Guo (@syg) with feedback from Kevin Gibbons (@bakkot).
The fix in this commit is quite simple and involves adding a missing test that we probably should have had.
It also adds more tests (in addition to what @syg provided) and fixes some typos in the documentation: somehow, I was using 'taylor' instead of 'tailor'.
I am deliberately keeping @syg's commit so that they get credit.
This is related to WebKit PR WebKit/WebKit#47926