-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[JSC] Fix Uint8Array fromBase64 and setFromBase64 for invalid 1-chunk input #47926
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
[JSC] Fix Uint8Array fromBase64 and setFromBase64 for invalid 1-chunk input #47926
Conversation
|
EWS run on previous version of this PR (hash 8614a8a) Details |
8614a8a to
6cb6e91
Compare
|
EWS run on previous version of this PR (hash 6cb6e91) Details |
|
This should get fixed in the coming days upstream. @syg provided a PR at simdutf/simdutf#822 |
|
Please see simdutf/simdutf#823 |
To clarify I did not provide a fix, just imported the test262 test that shows the failure. |
6cb6e91 to
aeb3e7c
Compare
|
EWS run on previous version of this PR (hash aeb3e7c) Details |
aeb3e7c to
372b19a
Compare
|
EWS run on previous version of this PR (hash 372b19a) Details |
372b19a to
33e2abc
Compare
|
EWS run on current version of this PR (hash 33e2abc) Details |
| static inline size_t fixSIMDUTFStopBeforePartialReadLength(std::span<const CharacterType> span, size_t readLengthFromSIMDUTF) | ||
| { | ||
| // Work around simdutf bug for stop-before-partial read length. | ||
| // FIXME: Remove once fixed in simdutf. |
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.
@Constellation I chose to work around simdutf's non-compliant behavior for the read length instead of keeping the entire slow path. WDYT?
33e2abc to
5353d81
Compare
… input https://bugs.webkit.org/show_bug.cgi?id=295578 rdar://155346981 Reviewed by Yusuke Suzuki. This PR updates simdutf to 7.3.3, fixes handling of invalid 1-chunk input in base64 decoding, and removes the slow fallback. First, base64 input is changed to unconditionally decode even when the expected decoded binary size is 0. Previously, there was a fast path in fromBase64 input to an empty Uint8Array when the expected decoded binary size is 0. This is incorrect when the input contains a single invalid chunk, as it skips decoding entirely when it should attempt to and report the error. Second, use simdutf to decode base64 for all values of lastChunkHandling. Previously, simdutf was only used for 'loose', and a slow fallback was used for 'strict' and 'stop-before-partial'. Now simdutf has support for all 3, so use it and remove the fallback. Note that simdutf currently has a bug for the read count when lastChunkHandling is 'stop-before-partial', which this patch works around. Canonical link: https://commits.webkit.org/297335@main
5353d81 to
c5b50b5
Compare
|
Committed 297335@main (c5b50b5): https://commits.webkit.org/297335@main Reviewed commits have been landed. Closing PR #47926 and removing active labels. |
|
To further clarify... yes, you 'only' provided the test. But this is obviously helpful as the issue was immediately reproducible. |
c5b50b5
33e2abc
🛠 playstation