classification
Title: Argument of wrong type is passed to fcntl()
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.5, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: brett.cannon, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2014-11-08 14:54 by serhiy.storchaka, last changed 2014-11-10 09:33 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
fcntl_arg_type.patch serhiy.storchaka, 2014-11-08 15:15 review
Messages (5)
msg230861 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-11-08 14:54
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.
msg230863 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-11-08 15:15
Here is a patch. It is much easier than I expected.
msg230929 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2014-11-10 01:25
Fixed in 3.5 as part of 6e6532d313a1 as it was easier to integrate it as part of the Clinic patch.
msg230945 - (view) Author: Roundup Robot (python-dev) Date: 2014-11-10 09:29
New changeset 61e99438c237 by Serhiy Storchaka in branch '2.7':
Issue #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 #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 #22821: Fixed fcntl() with integer argument on 64-bit big-endian
https://hg.python.org/cpython/rev/2d203a0b7908
msg230946 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-11-10 09:31
> 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().
History
Date User Action Args
2014-11-10 09:33:08serhiy.storchakasetstatus: open -> closed
assignee: serhiy.storchaka
stage: commit review -> resolved
resolution: fixed
versions: + Python 3.5
2014-11-10 09:31:58serhiy.storchakasetmessages: + msg230946
2014-11-10 09:29:54python-devsetnosy: + python-dev
messages: + msg230945
2014-11-10 01:25:30brett.cannonsetstage: patch review -> commit review
messages: + msg230929
versions: - Python 3.5
2014-11-08 15:15:20serhiy.storchakasetfiles: + fcntl_arg_type.patch
keywords: + patch
messages: + msg230863

stage: needs patch -> patch review
2014-11-08 14:54:38serhiy.storchakacreate