Skip to content

Assertion failure in Modules/_io/bytesio.c _io_BytesIO_readinto_impl: Assertion 'self->pos + len < PY_SSIZE_T_MAX' failed. #141311

@YuanchengJiang

Description

@YuanchengJiang

Bug report

Bug description:

import io

input_lines = ['windows\r\n']
joined = ''.join(input_lines)

encoding = 'utf-8'
newline = None
bufsize = 1

raw = io.BytesIO(joined.encode(encoding))
buf = io.BufferedReader(raw, buffer_size=bufsize)
textio = io.TextIOWrapper(buf, encoding=encoding, newline=newline)

textio.seek(2**63 - 1)
_ = textio.read(2)
python: ../Modules/_io/bytesio.c:616: _io_BytesIO_readinto_impl: Assertion `self->pos + len < PY_SSIZE_T_MAX' failed.
Aborted (core dumped)

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtopic-IOtype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions