Index: Modules/posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.329 diff -c -r2.329 posixmodule.c *** Modules/posixmodule.c 13 Oct 2004 15:30:56 -0000 2.329 --- Modules/posixmodule.c 4 Dec 2004 20:33:40 -0000 *************** *** 5350,5355 **** --- 5350,5359 ---- PyObject *buffer; if (!PyArg_ParseTuple(args, "ii:read", &fd, &size)) return NULL; + if (size < 0) { + errno = EINVAL; + return posix_error(); + } buffer = PyString_FromStringAndSize((char *)NULL, size); if (buffer == NULL) return NULL; Index: Objects/stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.226 diff -c -r2.226 stringobject.c *** Objects/stringobject.c 26 Oct 2004 01:52:37 -0000 2.226 --- Objects/stringobject.c 4 Dec 2004 20:34:13 -0000 *************** *** 52,57 **** --- 52,58 ---- PyString_FromStringAndSize(const char *str, int size) { register PyStringObject *op; + assert(size >= 0); if (size == 0 && (op = nullstring) != NULL) { #ifdef COUNT_ALLOCS null_strings++;