New submission from Paul Ganssle <p.gans...@gmail.com>:

When reviewing PR 12020 fixing an infinite loop in the e-mail module, I noticed 
that a *different* infinite loop is documented with a "# XXX" comment on line 
2724:

https://github.com/python/cpython/blob/58721a903074d28151d008d8990c98fc31d1e798/Lib/email/_header_value_parser.py#L2724

This is triggered when the policy's `max_line_length` is set to be shorter than 
minimum line length required by the "RFC 2047 chrome". It can be reproduced 
with:

    from email.policy import default

    policy = default.clone(max_line_length=7) # max_line_length = 78
    policy.fold("Subject", "12345678")

I could not find an entry on the tracker for this bug, but it is documented in 
the source code itself, so maybe I just didn't try hard enough.

Related but distinct bugs: #33529, #33524

I will submit a patch to fix this.

----------
messages: 339660
nosy: barry, p-ganssle, r.david.murray
priority: normal
severity: normal
status: open
title: Infinite loop with short maximum line lengths in EmailPolicy
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36564>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to