[New-bugs-announce] [issue2676] email/message.py [Message.get_content_type]: Trivial regex hangs on pathological input

Daniel Diniz report at bugs.python.org
Wed Apr 23 19:00:17 CEST 2008

New submission from Daniel Diniz <ajaksu at gmail.com>:

[Reported by Alberto Casado Martín [1]]

Message.get_content_type() hangs when very large values are split by the
ctype = paramre.split(value)[0].lower().strip() #line 439

paramre comes from line 26:
paramre = re.compile(r'\s*;\s*')

Unless the full fledged parser cited in the comment before line 26 is in
the works, I suggest splitting the string by ";" to get exactly the same
behavior in a more reliable way.

[1] http://mail.python.org/pipermail/python-dev/2008-April/078840.html

components: Library (Lib)
files: message.py.patch
keywords: patch
messages: 65702
nosy: ajaksu2, barry
severity: normal
status: open
title: email/message.py [Message.get_content_type]: Trivial regex hangs on pathological input
versions: Python 2.6
Added file: http://bugs.python.org/file10079/message.py.patch

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list