diff options
| author | cvs2svn <cvs2svn@FreeBSD.org> | 2008-11-19 10:43:57 +0000 | 
|---|---|---|
| committer | cvs2svn <cvs2svn@FreeBSD.org> | 2008-11-19 10:43:57 +0000 | 
| commit | f982be45e81588a27383cd1a3eb12789b8498904 (patch) | |
| tree | 07be283d015b2c39f95e655cb7328ff355bc47fa /lang/python32/files/patch-objects_stringobject.c | |
| parent | 856c5bf9f133ae5d553d972d5a940586d3f56048 (diff) | |
Notes
Diffstat (limited to 'lang/python32/files/patch-objects_stringobject.c')
| -rw-r--r-- | lang/python32/files/patch-objects_stringobject.c | 49 | 
1 files changed, 0 insertions, 49 deletions
| diff --git a/lang/python32/files/patch-objects_stringobject.c b/lang/python32/files/patch-objects_stringobject.c deleted file mode 100644 index af55c78a4928..000000000000 --- a/lang/python32/files/patch-objects_stringobject.c +++ /dev/null @@ -1,49 +0,0 @@ ---- Objects/stringobject.c.orig	2007-11-07 01:19:49.000000000 +0000 -+++ Objects/stringobject.c	2008-08-30 10:16:13.000000000 +0100 -@@ -71,6 +71,11 @@ - 		return (PyObject *)op; - 	} -  -+	if (size > PY_SSIZE_T_MAX - sizeof(PyStringObject)) { -+		PyErr_SetString(PyExc_OverflowError, "string is too large"); -+		return NULL; -+	} -+ - 	/* Inline PyObject_NewVar */ - 	op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); - 	if (op == NULL) -@@ -106,7 +111,7 @@ -  - 	assert(str != NULL); - 	size = strlen(str); --	if (size > PY_SSIZE_T_MAX) { -+	if (size > PY_SSIZE_T_MAX - sizeof(PyStringObject)) { - 		PyErr_SetString(PyExc_OverflowError, - 			"string is too long for a Python string"); - 		return NULL; -@@ -967,14 +972,24 @@ - 		Py_INCREF(a); - 		return (PyObject *)a; - 	} -+	/* Check that string sizes are not negative, to prevent an -+	   overflow in cases where we are passed incorrectly-created -+	   strings with negative lengths (due to a bug in other code). -+	*/ - 	size = a->ob_size + b->ob_size; --	if (size < 0) { -+	if (a->ob_size < 0 || b->ob_size < 0 || -+	    a->ob_size > PY_SSIZE_T_MAX - b->ob_size) { - 		PyErr_SetString(PyExc_OverflowError, - 				"strings are too large to concat"); - 		return NULL; - 	} - 	   - 	/* Inline PyObject_NewVar */ -+	if (size > PY_SSIZE_T_MAX - sizeof(PyStringObject)) { -+		PyErr_SetString(PyExc_OverflowError, -+				"strings are too large to concat"); -+		return NULL; -+	} - 	op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); - 	if (op == NULL) - 		return PyErr_NoMemory(); | 
