mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-131505: Move len boundary assertions before using len. (#131536)
Move len boundary assertions before using len.
This commit is contained in:
parent
3fa30d9e9c
commit
c45e661226
1 changed files with 1 additions and 1 deletions
|
@ -607,9 +607,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