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

FromBase64Transform whitespace issue #80040

Closed
appelgjo opened this issue Dec 29, 2022 · 4 comments
Closed

FromBase64Transform whitespace issue #80040

appelgjo opened this issue Dec 29, 2022 · 4 comments

Comments

@appelgjo
Copy link

This program gets a System.IndexOutOfRangeException in .NET Core 6, both on Windows and Linux:

using System.Security.Cryptography;
using System.Text;

string b64 =
    "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2Np" +
    "\n" +
    "bmcgZWxpdC4K";
using Stream input = new MemoryStream(Encoding.ASCII.GetBytes(b64));
using ICryptoTransform decoder = new FromBase64Transform(FromBase64TransformMode.IgnoreWhiteSpaces);
using Stream decoding = new CryptoStream(input, decoder, CryptoStreamMode.Read);
using Stream output = Console.OpenStandardOutput();
decoding.CopyTo(output);

"\r\n" instead of "\n" works fine.

Similar to #46922 .

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Dec 29, 2022
@ghost
Copy link

ghost commented Dec 29, 2022

Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

This program gets a System.IndexOutOfRangeException in .NET Core 6, both on Windows and Linux:

using System.Security.Cryptography;
using System.Text;

string b64 =
    "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2Np" +
    "\n" +
    "bmcgZWxpdC4K";
using Stream input = new MemoryStream(Encoding.ASCII.GetBytes(b64));
using ICryptoTransform decoder = new FromBase64Transform(FromBase64TransformMode.IgnoreWhiteSpaces);
using Stream decoding = new CryptoStream(input, decoder, CryptoStreamMode.Read);
using Stream output = Console.OpenStandardOutput();
decoding.CopyTo(output);

"\r\n" instead of "\n" works fine.

Similar to #46922 .

Author: appelgjo
Assignees: -
Labels:

area-System.Security

Milestone: -

@gfoidl
Copy link
Member

gfoidl commented Dec 29, 2022

Sounds similar to #76918

@appelgjo
Copy link
Author

Duplicate of #76918

@vcsjones
Copy link
Member

Thanks for the issue report. Since a duplicate has been identified, I am going to close this one out in favor of the linked issue.

@vcsjones vcsjones closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2022
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Dec 29, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jan 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants