[issue31577] crash in os.utime() in case of a bad ns argument

2018-09-14 Thread Zachary Ware


Zachary Ware  added the comment:

Serhiy has opened bpo-34676 for the idea of restricting PyNumber_Divmod()'s 
return type, so I'm closing the issue.

--
stage: commit review -> resolved
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2018-09-13 Thread Zachary Ware


Zachary Ware  added the comment:

The crash is fixed, so I've lowered the priority.  Serhiy, are you still 
interested in pursuing an alternative fix in 3.8, or content with what's merged?

--
priority: release blocker -> normal
resolution:  -> fixed
stage: patch review -> commit review
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2018-09-13 Thread Ned Deily


Ned Deily  added the comment:

Thanks, Serihy.  Can we either close this now or remove 3.7 and "release 
blocker"?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2018-09-12 Thread miss-islington


miss-islington  added the comment:


New changeset 329ea4ef7cc3a907a64c6f0702fc93206b6744de by Miss Islington (bot) 
in branch '3.7':
bpo-31577: Fix a crash in os.utime() in case of a bad ns argument. (GH-3752)
https://github.com/python/cpython/commit/329ea4ef7cc3a907a64c6f0702fc93206b6744de


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2018-09-12 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8653

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2018-09-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 0bd1a2dcfdf36b181385ae61361e7692f4ebb0fd by Serhiy Storchaka 
(Oren Milman) in branch 'master':
bpo-31577: Fix a crash in os.utime() in case of a bad ns argument. (GH-3752)
https://github.com/python/cpython/commit/0bd1a2dcfdf36b181385ae61361e7692f4ebb0fd


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2018-09-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 3752 LGTM. I have reran CI tests, if they will be passed, the PR can be 
merged. This PR was not merged only because we discussed possible alternate 
solutions and lost an opportunity to merge it for 3.7.0.

I agree that timedelta.__divmod__ doesn't have such issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2018-09-12 Thread Ned Deily


Ned Deily  added the comment:

@Serihy, @Mark, others, any suggestions for what to do for 3.7.1?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2018-09-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2018-09-10 Thread Zachary Ware


Zachary Ware  added the comment:

Adding Ned and marking as release blocker as this is a crasher in 3.7.0.

--
nosy: +ned.deily
priority: normal -> release blocker

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2018-09-10 Thread Zachary Ware


Zachary Ware  added the comment:

We definitely can't make that change to PyNumber_Divmod in 3.7 at this point, 
I'm sure someone somewhere is relying on being able to get arbitrary 
information out of their objects with `divmod(crazy_object)`.  I don't know 
enough math to say whether there could be any legitimate mathematical use for 
arbitrary return values so I leave it to others to determine whether we could 
make that consider that change in 3.8 just to clean things up.

I've looked through _datetimemodule.c and I don't see how timedelta.__divmod__ 
could fail like this, since it actually creates new timedelta objects from its 
arguments to work from.

--
nosy: +zach.ware
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2017-09-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is also similar issue in timedelta.__divmod__.

PyLong_Type.tp_as_number->nb_divmod() works only with integers.

The different way of solving this issue is used in microseconds_to_delta_ex() 
in _datetimemodule.c.

Perhaps the best solution is to add a check that the result of nb_divmod() is a 
2-tuple in PyNumber_Divmod(). This could fix similar errors in third-party 
code. What is your thoughts Mark?

--
nosy: +mark.dickinson, serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2017-09-25 Thread Oren Milman

Changes by Oren Milman :


--
keywords: +patch
pull_requests: +3739
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2017-09-25 Thread Oren Milman

Oren Milman added the comment:

I opened a PR.
I think another fix might be to use
PyLong_Type.tp_as_number->long_divmod() instead of PyNumber_Divmod().

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31577] crash in os.utime() in case of a bad ns argument

2017-09-25 Thread Oren Milman

New submission from Oren Milman:

The following code causes the interpreter to crash:
class BadInt:
def __divmod__(*args):
return 42

import os
os.utime('foo.txt', ns=(BadInt(), 1))


This is because split_py_long_to_s_and_ns() (in Modules/posixmodule.c) assumes
that PyNumber_Divmod() returns a 2-tuple, and passes it to PyTuple_GET_ITEM(),
which assumes it is a tuple. Thus, PyTuple_GET_ITEM() might return a non-NULL
value which is not an address of a Python object.

--
components: Extension Modules
messages: 302962
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: crash in os.utime() in case of a bad ns argument
type: crash
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com