freebsd-ports/lang/python24/files/patch-objects-bufferobject.c
Martin Wilke 5d6556dc39 - add patches from upstream svn rev.65333, fix integer overflows in
memory allocation (CVE-2008-2315 and CVE-2008-2316)
- also apply upstream svn rev.65262, fixes overflow checks in memory
  allocation (CVE-2008-3142 and CVE-2008-3144)

Approved by:	portmgr (pav)
Security:	http://www.vuxml.org/freebsd/0dccaa28-7f3c-11dd-8de5-0030843d3802.html
2008-09-11 08:05:23 +00:00

13 lines
424 B
C

--- Objects/bufferobject.c.orig 2008-03-02 20:20:32.000000000 +0100
+++ Objects/bufferobject.c
@@ -384,6 +384,10 @@ buffer_repeat(PyBufferObject *self, int
count = 0;
if (!get_buf(self, &ptr, &size))
return NULL;
+ if (count > INT_MAX / size) {
+ PyErr_SetString(PyExc_MemoryError, "result too large");
+ return NULL;
+ }
ob = PyString_FromStringAndSize(NULL, size * count);
if ( ob == NULL )
return NULL;