[issue2587] PyString_FromStringAndSize() to be considered unsane

2008-04-08 Thread Justin Ferguson
Justin Ferguson <[EMAIL PROTECTED]> added the comment: As an addemdum, consider the following code (theres no assert, but it wouldnt have helped you outside of debug builds anyways): 488 static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args) 489 { 490 PyObject *buf; 491

[issue2587] PyString_FromStringAndSize() to be considered unsane

2008-04-08 Thread Justin Ferguson
Justin Ferguson <[EMAIL PROTECTED]> added the comment: Adding a poc from 2586 to demonstrate my point, this causes a call to the allocator requesting zero bytes. Added file: http://bugs.python.org/file9985/python-2.5.2-zlib-unflush-misallocation.py __ Tracker <[

[issue2587] PyString_FromStringAndSize() to be considered unsane

2008-04-08 Thread Justin Ferguson
Justin Ferguson <[EMAIL PROTECTED]> added the comment: The problem with assert()'s is they require debugging to be enabled, obviously, who compiles it that way? You may not even want to worry about the second check, when you pass it into the allocator it gets converted to an unsigned int which w

[issue2587] PyString_FromStringAndSize() to be considered unsane

2008-04-08 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: This is done already: the second line in PyString_FromStringAndSize() is assert(size>=0); You have to build python in debug mode though... Oh, I realize this is not a real patch: no error is raised, and why PYSSIZE_T_MAX/sizeof(PySt

[issue2587] PyString_FromStringAndSize() to be considered unsane

2008-04-08 Thread Justin Ferguson
New submission from Justin Ferguson <[EMAIL PROTECTED]>: The PyString_FromStringAndSize() function takes a pointer and signed integer as input parameters however it fails to adequately check the sanity of the integer argument. Because of the failure to check for negative values and because it sum