[issue7309] crasher in str(Exception())

Ezio Melotti report at bugs.python.org
Sat Nov 14 03:06:46 CET 2009


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

I don't know if this is a real problem. If someone who want to crash
someone else program is able to do something like 'u.reason =
somethingweird' there are already more serious problems to solve.
I don't see why someone would want to do that in his own program either.

So, even assuming that PyString_AS_STRING() might indeed crash when some
weird arg is passed, the problem should be fixed there and not
typechecking all the args before calling it. (i.e. even if you fix it
for Exceptions, there are probably several other places where you can
set arbitrary things that will be passed to PyString_AS_STRING() anyway.)

That said, I played with it and tried to set u.reason with a number of
things (including big numbers and strings, Unicode chars outside the
BMP, builtin types, functions, modules) and str(u) either returned an
empty string or a random sequence of bytes (like your 'E\x03'), but it
didn't crash.

Unless you can find a way to make it crash, I'd close this as 'invalid'.

----------
nosy: +ezio.melotti
priority:  -> low
stage:  -> test needed

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


More information about the Python-bugs-list mailing list