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

Emails with single charcter as the From Name exception when getting From address #846

Closed
julietreid opened this issue Oct 19, 2022 · 1 comment
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@julietreid
Copy link

Describe the bug
An email with a single character From Name throws exception when trying to read the From address

Platform:

  • OS: Windows
  • .NET Runtime: .NET 6.0
  • .NET Framework: .NET 6.0
  • MimeKit Version: 3.4.1

To Reproduce
Steps to reproduce the behavior:

  1. Load the attached email
  2. Attempt to read the From address
  3. ArgumentOutOfRangeException

Expected behavior
Can get the name/address from the From field

Code Snippets

async Task Main()
{
	var message = await MimeMessage.LoadAsync(@"test1char.txt");
	Console.WriteLine(message.From.Mailboxes.FirstOrDefault()?.Address);
}

Additional context

Specified argument was out of the range of valid values. (Parameter 'minimumLength')
   at System.Buffers.TlsOverPerCoreLockedStacksArrayPool`1.Rent(Int32 minimumLength)
   at MimeKit.Utils.MimeUtils.Unquote(Byte[] text, Int32 startIndex, Int32 length, Boolean convertTabsToSpaces) in D:\src\MimeKit\MimeKit\Utils\MimeUtils.cs:line 584
   at MimeKit.InternetAddress.TryParse(AddressParserFlags flags, ParserOptions options, Byte[] text, Int32& index, Int32 endIndex, Int32 groupDepth, InternetAddress& address) in D:\src\MimeKit\MimeKit\InternetAddress.cs:line 856
   at MimeKit.InternetAddressList.TryParse(AddressParserFlags flags, ParserOptions options, Byte[] text, Int32& index, Int32 endIndex, Boolean isGroup, Int32 groupDepth, List`1& addresses) in D:\src\MimeKit\MimeKit\InternetAddressList.cs:line 592
   at MimeKit.MimeMessage.AddAddresses(Header header, InternetAddressList list) in D:\src\MimeKit\MimeKit\MimeMessage.cs:line 2475
   at MimeKit.MimeMessage.GetLazyLoadedAddresses(HeaderId id, LazyLoadedFields bit) in D:\src\MimeKit\MimeKit\MimeMessage.cs:line 571
   at MimeKit.MimeMessage.get_From() in D:\src\MimeKit\MimeKit\MimeMessage.cs:line 596
   at UserQuery.Main(), line 4

File that crashes
test1char.txt

@jstedfast jstedfast added bug Something isn't working duplicate This issue or pull request already exists labels Oct 23, 2022
@jstedfast
Copy link
Owner

This is the same bug as issue #847 that I just fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants