Diff of /Objects/stringobject.c [64f85f] .. [008c31]  Maximize  Restore

Repo status: analyzing...

Switch to side-by-side view

--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -52,6 +52,13 @@
 PyString_FromStringAndSize(const char *str, int size)
 {
 	register PyStringObject *op;
+
+	if (size < 0) {
+		PyErr_SetString(PyExc_SystemError,
+		    "Negative size passed to PyString_FromStringAndSize");
+		return NULL;
+	}
+
 	if (size == 0 && (op = nullstring) != NULL) {
 #ifdef COUNT_ALLOCS
 		null_strings++;