[New-bugs-announce] [issue7309] crasher in str(Exception())

Armin Rigo report at bugs.python.org
Thu Nov 12 11:50:49 CET 2009


New submission from Armin Rigo <arigo at users.sourceforge.net>:

The __str__ method of some exception classes reads attributes without
typechecking them.  Alternatively, the issue could be that the user is
allowed to set the value of these attributes directly, without
typecheck.  The typechecking is only done when we create the exception,
but not later.  Example:

>>> u=UnicodeTranslateError(u'x', 1, 5, 'bah')
>>> u.reason = 0x345345345345345345  
>>> str(u)
"can't translate characters in position 1-4: E\x03"

The 'E\x03' comes from PyString_AS_STRING(reason).  By playing enough it
is probably possible to come up with a real crasher.

----------
components: Interpreter Core
messages: 95159
nosy: arigo
severity: normal
status: open
title: crasher in str(Exception())
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7309>
_______________________________________


More information about the New-bugs-announce mailing list