Skip to content

Fix incorrect scan of bad email address#688

Merged
Martin1887 merged 1 commit intomasterfrom
fix_bad_email
Jul 5, 2023
Merged

Fix incorrect scan of bad email address#688
Martin1887 merged 1 commit intomasterfrom
fix_bad_email

Conversation

@raphlinus
Copy link
Collaborator

The old scanner mistakenly accepted an email address with an empty label before the @ symbol.

This commit also adds some hand-written tests. I also ran a bit of property testing against the regex.

Also renumbers regression tests that were incorrectly numbered (probably due to merge conflict).

Fixes #687

The old scanner mistakenly accepted an email address with an empty label before the @ symbol.

This commit also adds some hand-written tests. I also ran a bit of property testing against the regex.

Also renumbers regression tests that were incorrectly numbered (probably due to merge conflict).

Fixes #687
@raphlinus
Copy link
Collaborator Author

If people want to replicate my property testing (which is admittedly not very sophisticated), here's a gist. It was able to detect the reported issue, but not artificially induced bugs in label length, likely because the probability of a randomly generated label being valid gets very small as the length increases. A better strategy would be to generate a good email address from the regex, then mutate one byte. I didn't do that, but perhaps somebody is motivated to.

@Martin1887
Copy link
Collaborator

Great!

@Martin1887 Martin1887 merged commit c6b8fa6 into master Jul 5, 2023
@Martin1887 Martin1887 deleted the fix_bad_email branch July 5, 2023 07:58
@mgeisler
Copy link
Collaborator

mgeisler commented Jul 6, 2023

Cool, that was much easier than I thought!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<@1> parsed as inline link

3 participants