We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b75bc9b commit 992d5f5Copy full SHA for 992d5f5
Modules/posixmodule.c
@@ -11451,9 +11451,11 @@ static Py_ssize_t
11451
os_readinto_impl(PyObject *module, int fd, Py_buffer *buffer)
11452
/*[clinic end generated code: output=8091a3513c683a80 input=810c820f4d9b1c6b]*/
11453
{
11454
- // Cap to max read size to prevent overflow in cast to size_t for _Py_read.
11455
- size_t length = Py_MIN(buffer->len, _PY_READ_MAX);
11456
- return _Py_read(fd, buffer->buf, length);
+ if (buffer->len < 0) {
+ errno = EINVAL
+ return posix_error();
11457
+ }
11458
+ return _Py_read(fd, buffer->buf, buffer->len);
11459
}
11460
11461
#if (defined(HAVE_SENDFILE) && (defined(__FreeBSD__) || defined(__DragonFly__) \
0 commit comments