mirror of
https://github.com/python/cpython
synced 2024-09-05 08:17:45 +00:00
Fix undefined behaviour in datetime.time.fromisoformat() (#111982)
Fix undefined behaviour in datetime.time.fromisoformat() when parsing a string without a timezone. 'tzoffset' is not assigned to by parse_isoformat_time if it returns 0, but time_fromisoformat then passes tzoffset to another function, which is undefined behaviour (even if the function in question does not use the value).
This commit is contained in:
parent
38035fed9b
commit
21615f77b5
|
@ -4630,7 +4630,7 @@ time_fromisoformat(PyObject *cls, PyObject *tstr) {
|
|||
}
|
||||
|
||||
int hour = 0, minute = 0, second = 0, microsecond = 0;
|
||||
int tzoffset, tzimicrosecond = 0;
|
||||
int tzoffset = 0, tzimicrosecond = 0;
|
||||
int rv = parse_isoformat_time(p, len,
|
||||
&hour, &minute, &second, µsecond,
|
||||
&tzoffset, &tzimicrosecond);
|
||||
|
|
Loading…
Reference in a new issue