Skip to content

CVE-2023-27043 Unicode follow-up: add parseaddr regression test (Python 3.7) - #82

Open
icanhasmath wants to merge 1 commit into
3.7.17.xfrom
cve-2023-27043-unicode-refactor-python-3-7
Open

icanhasmath wants to merge 1 commit into
3.7.17.xfrom
cve-2023-27043-unicode-refactor-python-3-7

Conversation

@icanhasmath

Copy link
Copy Markdown

Summary

  • Follow-up to the 2.7-branch Unicode refactor for CVE-2023-27043 (commit c98f6b9d0f8).
  • The code portion of that refactor (isinstance(addr, (str, unicode)) + addr.encode('utf-8')) is Python-2-only and would NameError on 3.x, so no source change to Lib/email/utils.py is required or applied here.
  • Ports only the test intent: a direct parseaddr(strict=True) regression test covering ASCII and non-ASCII ("Sürname, Firstname" <to@example.com>), asserting (a) non-empty result and (b) strict-mode agrees with non-strict-mode — the same shape as the 2.7 test.

Verification

Loaded the current 3.7.17.x Lib/email/utils.py under a Python 3 interpreter (pure-Python module, safely isolated from stdlib) and ran the four test cases. All pass both assertions, confirming the existing CVE-2023-27043 fix on 3.7.17.x already handles Unicode correctly because Python 3 str is natively Unicode.

Test plan

  • ./python -m test test_email -k test_parseaddr_unicode passes on Linux
  • Full test_email suite still passes (no regressions in neighboring tests)
  • Windows build: same test run

🤖 Generated with Claude Code

The 2.7-branch Unicode refactor for CVE-2023-27043 (c98f6b9) does not
port to Python 3: its code change uses the Python-2-only `unicode` name
and UTF-8-encodes to bytes, both of which are no-ops / errors on 3.x
where `str` is already Unicode. Port only the test intent.

Verified against the current 3.7.17.x parseaddr: strict mode accepts
ASCII and non-ASCII input and agrees with non-strict mode, so no source
change to Lib/email/utils.py is required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant