[issue6344] mmap.read() crashes when passed a negative argument

Amaury Forgeot d'Arc report at bugs.python.org
Sun Jun 28 11:47:54 CEST 2009


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

> +	if (n < 0)

I suggest a comment like:

/* The difference can overflow, only if self->size is greater than
 * PY_SSIZE_T_MAX.  But then the operation cannot possibly succeed,
 * because the mapped area and the returned string each need more 
 * than half of the addressable memory.  So we clip the size, and let
 * the code below raise MemoryError.
 */

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6344>
_______________________________________


More information about the Python-bugs-list mailing list