mirror of
https://github.com/python/cpython.git
synced 2025-11-13 07:26:31 +00:00
Fix
[ 1077106 ] Negative numbers to os.read() cause segfault Sorry for sitting on this for so long! Is there a chance it could make 2.3.5?
This commit is contained in:
parent
acdef858a5
commit
9867ced6c2
1 changed files with 4 additions and 0 deletions
|
|
@ -5349,6 +5349,10 @@ posix_read(PyObject *self, PyObject *args)
|
||||||
PyObject *buffer;
|
PyObject *buffer;
|
||||||
if (!PyArg_ParseTuple(args, "ii:read", &fd, &size))
|
if (!PyArg_ParseTuple(args, "ii:read", &fd, &size))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if (size < 0) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return posix_error();
|
||||||
|
}
|
||||||
buffer = PyString_FromStringAndSize((char *)NULL, size);
|
buffer = PyString_FromStringAndSize((char *)NULL, size);
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue