removed check for null characters in literal function #176
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi - I am developing an app using rust-imap to get emails.
I implemented a full mailbox sync for my clients mailbox and started running it, after a few thousand mails in I got a crash. I started investigating and I tracked down the culprit all the way to these lines.
If I remove them it works.
What the lines did was that they throw an error if there is a null chracter somewhere in the email.
Now let me explain: What my client has in his mailbox is a corrupted mail that contains a binary within it.
That cetainly does not meet any standars - however, in practice its bound to be encountered.
My AST parsers and sanitizers that are run after that handle the mess just fine and delete it as is propper, leaving the base message readable, just like it is readable in Thunderbird and webmailers.
Without the checker it works just fine, and it is an unnecessary crash that does not reflect real world data.
The comment said:
// FIXME: what ErrorKind should this have?
Probably this shouldn't be an error at all.
I am not sure if you are encountering this issue in production, and if this handles genuine cases for you.
But just silent failure is definetly not expected behavior so probably this is pretty rare.
I thought about sanitizing the string in this case but it would hurt performance too much to either make it mutable or allocate a new array here.
So here is my working fix, with food for thought.
Best!