Skip to content

SystemError buffer overflow in fcntl.fcntl #141338

@YuanchengJiang

Description

@YuanchengJiang

Bug report

Bug description:

import tempfile
import os
import fcntl

nbytes = 2024
tf = tempfile.NamedTemporaryFile(delete=2**15 - 1)
tf_name = tf.name

with open(tf_name, 'wb') as f:
    get_result = fcntl.fcntl(f, fcntl.F_GETOWN_EX, b'' * nbytes)
SystemError: buffer overflow
cpython/Lib/tempfile.py:484: ResourceWarning: Implicitly cleaning up <_TemporaryFileWrapper file=<_io.BufferedRandom name='/tmp/tmp_o0z83c9'>>

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions