Skip to content

bpo-31577: Fix a crash in os.utime() in case of a bad ns argument#3752

Merged
serhiy-storchaka merged 2 commits into
python:masterfrom
orenmn:bpo31577-fix-crash
Sep 12, 2018
Merged

bpo-31577: Fix a crash in os.utime() in case of a bad ns argument#3752
serhiy-storchaka merged 2 commits into
python:masterfrom
orenmn:bpo31577-fix-crash

Conversation

@orenmn

@orenmn orenmn commented Sep 25, 2017

Copy link
Copy Markdown
Contributor
  • in posixmodule.c - add a check whether PyNumber_Divmod() returned a 2-tuple.
  • in test_os.py - add tests to verify that the crash is no more.

https://bugs.python.org/issue31577

@zware zware left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benjaminp

Copy link
Copy Markdown
Contributor

Why not check the type of the tuple entries is int?

@serhiy-storchaka

Copy link
Copy Markdown
Member

Returning non-int doesn't cause a crash. Actually non-int objects with __int__() are supported (e.g. NumPy integers).

@serhiy-storchaka serhiy-storchaka merged commit 0bd1a2d into python:master Sep 12, 2018
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @orenmn for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 12, 2018
…ythonGH-3752)

(cherry picked from commit 0bd1a2d)

Co-authored-by: Oren Milman <orenmn@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

GH-9222 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request Sep 12, 2018
…H-3752)

(cherry picked from commit 0bd1a2d)

Co-authored-by: Oren Milman <orenmn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants