Author Oren Milman
Recipients Oren Milman
Date 2017-09-25.16:47:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1506358077.62.0.262986415269.issue31577@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-09-25 16:47:57Oren Milmansetrecipients: + Oren Milman
2017-09-25 16:47:57Oren Milmansetmessageid: <1506358077.62.0.262986415269.issue31577@psf.upfronthosting.co.za>
2017-09-25 16:47:57Oren Milmanlinkissue31577 messages
2017-09-25 16:47:57Oren Milmancreate