[New-bugs-announce] [issue31577] crash in os.utime() in case of a bad ns argument
Oren Milman
report at bugs.python.org
Mon Sep 25 12:47:57 EDT 2017
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 <report at bugs.python.org>
<https://bugs.python.org/issue31577>
_______________________________________
More information about the New-bugs-announce
mailing list