Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument of wrong type is passed to fcntl() #67010

Closed
serhiy-storchaka opened this issue Nov 8, 2014 · 5 comments
Closed

Argument of wrong type is passed to fcntl() #67010

serhiy-storchaka opened this issue Nov 8, 2014 · 5 comments
Assignees
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 22821
Nosy @brettcannon, @serhiy-storchaka
Files
  • fcntl_arg_type.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2014-11-10.09:33:08.187>
    created_at = <Date 2014-11-08.14:54:38.212>
    labels = ['extension-modules', 'type-bug']
    title = 'Argument of wrong type is passed to fcntl()'
    updated_at = <Date 2014-11-10.09:33:08.186>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2014-11-10.09:33:08.186>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2014-11-10.09:33:08.187>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules']
    creation = <Date 2014-11-08.14:54:38.212>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['37150']
    hgrepos = []
    issue_num = 22821
    keywords = ['patch']
    message_count = 5.0
    messages = ['230861', '230863', '230929', '230945', '230946']
    nosy_count = 3.0
    nosy_names = ['brett.cannon', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue22821'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @serhiy-storchaka
    Copy link
    Member Author

    Arguments of wrong type is passed to C function fcntl() in the fcntl module.

    Third argument of fcntl() should be either pointer to binary structure or C int. But C long is passed instead. All works on platforms where sizeof(long) == sizeof(int) or on little-endian platforms, but on big-endian platform with sizeof(long) != sizeof(int) this will pass wrong value.

    @serhiy-storchaka serhiy-storchaka added extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Nov 8, 2014
    @serhiy-storchaka
    Copy link
    Member Author

    Here is a patch. It is much easier than I expected.

    @brettcannon
    Copy link
    Member

    Fixed in 3.5 as part of 6e6532d313a1 as it was easier to integrate it as part of the Clinic patch.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 10, 2014

    New changeset 61e99438c237 by Serhiy Storchaka in branch '2.7':
    Issue bpo-22821: Fixed fcntl() with integer argument on 64-bit big-endian
    https://hg.python.org/cpython/rev/61e99438c237

    New changeset 45e8aed69767 by Serhiy Storchaka in branch '3.4':
    Issue bpo-22821: Fixed fcntl() with integer argument on 64-bit big-endian
    https://hg.python.org/cpython/rev/45e8aed69767

    New changeset 2d203a0b7908 by Serhiy Storchaka in branch 'default':
    Issue bpo-22821: Fixed fcntl() with integer argument on 64-bit big-endian
    https://hg.python.org/cpython/rev/2d203a0b7908

    @serhiy-storchaka
    Copy link
    Member Author

    Fixed in 3.5 as part of 6e6532d313a1 as it was easier to integrate it as
    part of the Clinic patch.

    6e6532d313a1 has introduced other bug ("l" was parsed to int). Changed to "I"
    for reasons described in the comment in fcntl_ioctl_impl().

    @serhiy-storchaka serhiy-storchaka self-assigned this Nov 10, 2014
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants