mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
[3.14] gh-131505: Move len boundary assertions before using len. (GH-131536) (GH-134239)
gh-131505: Move len boundary assertions before using len. (GH-131536)
Move len boundary assertions before using len.
(cherry picked from commit c45e661226
)
Co-authored-by: naya451 <41294408+naya451@users.noreply.github.com>
This commit is contained in:
parent
9be3413b60
commit
ccaf865364
1 changed files with 1 additions and 1 deletions
|
@ -583,9 +583,9 @@ _io_BytesIO_readinto_impl(bytesio *self, Py_buffer *buffer)
|
|||
len = 0;
|
||||
}
|
||||
|
||||
memcpy(buffer->buf, PyBytes_AS_STRING(self->buf) + self->pos, len);
|
||||
assert(self->pos + len < PY_SSIZE_T_MAX);
|
||||
assert(len >= 0);
|
||||
memcpy(buffer->buf, PyBytes_AS_STRING(self->buf) + self->pos, len);
|
||||
self->pos += len;
|
||||
|
||||
return PyLong_FromSsize_t(len);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue