From 4a0144c0de212e2bf63fe111939b4085cdd154df Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 9 Jun 1998 15:08:41 +0000 Subject: Should check that PyObject_Str() really returned a string! --- Objects/stringobject.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 5e6a5a5..dffc8e0 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -900,6 +900,11 @@ PyString_Format(format, args) temp = PyObject_Str(v); if (temp == NULL) goto error; + if (!PyString_Check(temp)) { + PyErr_SetString(PyExc_TypeError, + "%s argument has non-string str()"); + goto error; + } buf = PyString_AsString(temp); len = PyString_Size(temp); if (prec >= 0 && len > prec) -- cgit v0.12