summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2007-09-10 21:38:27 (GMT)
committerBrett Cannon <bcannon@gmail.com>2007-09-10 21:38:27 (GMT)
commita0c05512ec071b98e8170c8cfe845bee6fc934da (patch)
tree83da314bd97dd8153e1ffd85f933c24087fae956 /Objects
parentf3d280e62acfa2d597dff13105f7fec4a5eeb8e6 (diff)
downloadcpython-a0c05512ec071b98e8170c8cfe845bee6fc934da.zip
cpython-a0c05512ec071b98e8170c8cfe845bee6fc934da.tar.gz
cpython-a0c05512ec071b98e8170c8cfe845bee6fc934da.tar.bz2
Fix a possible segfault from recursing too deep to get the repr of a list.
Closes issue #1096.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/listobject.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index c0621dc..92bad8c 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -324,7 +324,10 @@ list_repr(PyListObject *v)
so must refetch the list size on each iteration. */
for (i = 0; i < Py_Size(v); ++i) {
int status;
+ if (Py_EnterRecursiveCall(" while getting the repr of a list"))
+ goto Done;
s = PyObject_Repr(v->ob_item[i]);
+ Py_LeaveRecursiveCall();
if (s == NULL)
goto Done;
status = PyList_Append(pieces, s);