summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-04-03 00:57:33 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-04-03 00:57:33 (GMT)
commitbea424af98468a7fc5c505c949218e22862d2b40 (patch)
tree6990df25667157e2a0d4f50f5e2ac0887810f046 /Objects/unicodeobject.c
parent3928276e6442f52b0a2717df8d8441dbe03ccd53 (diff)
downloadcpython-bea424af98468a7fc5c505c949218e22862d2b40.zip
cpython-bea424af98468a7fc5c505c949218e22862d2b40.tar.gz
cpython-bea424af98468a7fc5c505c949218e22862d2b40.tar.bz2
more _PyString_Resize error checking
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 930d58c..aab33b5 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1848,7 +1848,8 @@ encode_char:
if (inShift)
*out++ = '-';
- _PyString_Resize(&v, out - start);
+ if (_PyString_Resize(&v, out - start))
+ return NULL;
return v;
}
@@ -2169,7 +2170,8 @@ PyUnicode_EncodeUTF8(const Py_UNICODE *s,
/* Cut back to size actually needed. */
nneeded = p - PyString_AS_STRING(v);
assert(nneeded <= nallocated);
- _PyString_Resize(&v, nneeded);
+ if (_PyString_Resize(&v, nneeded))
+ return NULL;
}
return v;
@@ -3129,7 +3131,8 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
*p++ = PyString_AS_STRING(repr)[1];
*p = '\0';
- _PyString_Resize(&repr, p - PyString_AS_STRING(repr));
+ if (_PyString_Resize(&repr, p - PyString_AS_STRING(repr)))
+ return NULL;
return repr;
}
@@ -3350,7 +3353,8 @@ PyObject *PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s,
*p++ = (char) ch;
}
*p = '\0';
- _PyString_Resize(&repr, p - q);
+ if (_PyString_Resize(&repr, p - q))
+ return NULL;
return repr;
}