-
-
Notifications
You must be signed in to change notification settings - Fork 7
Allow whitespace for decoding #184
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
46fb821 to
94ddf8d
Compare
925bc44 to
0f84bef
Compare
|
/azp run Base64-Fuzz |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Fuzz ran for over an hour w/o finding something. I'm going to merge, so that regular fuzz-run can detect something (or hopefully not). |
| } | ||
| } | ||
| //------------------------------------------------------------------------- | ||
| private static OperationStatus DecodeWithWithespaceBlockwise<T, TOperation>( |
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.
Whitespace is misspelled here
|
I ran this code against the existing tests in: https://github.com/dotnet/runtime/blob/8d3070f90c557b920b0e53489f617ec55b186eed/src/libraries/System.Memory/tests/Base64/Base64DecoderUnitTests.cs The I believe there may be an issue with the way consumed bytes are being handled, according to the definition of consumed: "The number of input bytes consumed during the operation. This can be used to slice the input for subsequent calls, if necessary." |
Looks like we have different definitions for "consumed". For me in the case of "AQ== " it should be 5. Rationale is that the decoding operation actually consumed it and to accord for "used to slice the input for subsequent calls". For the empty string "" it's 0, as there's nothing to do. If whitespace is to be tolerated, then it should account as consumed too. |
To be strict maybe there should be two counters: At the moment I don't see need to expose that additional counter. For usage all that's important is how many bytes/chars are consumed from the base64-input, and how many bytes are written to the data-output. |
Introduced
Base64/source/gfoidl.Base64/WhitespaceMode.cs
Lines 8 to 19 in b6e941e