Skip to content

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

Description

@YuanchengJiang

Bug report

Bug description:

importioinput_lines= ['windows\r\n']
joined=''.join(input_lines)
encoding='utf-8'newline=Nonebufsize=1raw=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

    3.13bugs and security fixesextension-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