Message262986
Plistlib fails to load dates before year 1901 and after year 2038 in binary format on platforms with 32-bit time_t.
>>> data = plistlib.dumps(datetime.datetime(1901, 1, 1), fmt=plistlib.FMT_BINARY)
>>> plistlib.loads(data)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/serhiy/py/cpython/Lib/plistlib.py", line 1006, in loads
fp, fmt=fmt, use_builtin_types=use_builtin_types, dict_type=dict_type)
File "/home/serhiy/py/cpython/Lib/plistlib.py", line 997, in load
return p.parse(fp)
File "/home/serhiy/py/cpython/Lib/plistlib.py", line 623, in parse
return self._read_object(self._object_offsets[top_object])
File "/home/serhiy/py/cpython/Lib/plistlib.py", line 688, in _read_object
return datetime.datetime.utcfromtimestamp(f + (31 * 365 + 8) * 86400)
OverflowError: timestamp out of range for platform time_t
>>> data = plistlib.dumps(datetime.datetime(2039, 1, 1), fmt=plistlib.FMT_BINARY)
>>> plistlib.loads(data)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/serhiy/py/cpython/Lib/plistlib.py", line 1006, in loads
fp, fmt=fmt, use_builtin_types=use_builtin_types, dict_type=dict_type)
File "/home/serhiy/py/cpython/Lib/plistlib.py", line 997, in load
return p.parse(fp)
File "/home/serhiy/py/cpython/Lib/plistlib.py", line 623, in parse
return self._read_object(self._object_offsets[top_object])
File "/home/serhiy/py/cpython/Lib/plistlib.py", line 688, in _read_object
return datetime.datetime.utcfromtimestamp(f + (31 * 365 + 8) * 86400)
OverflowError: timestamp out of range for platform time_t
Proposed patch fixes this issue. |
|
Date |
User |
Action |
Args |
2016-04-07 09:46:22 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, ronaldoussoren, belopolsky |
2016-04-07 09:46:22 | serhiy.storchaka | set | messageid: <1460022382.4.0.161874143104.issue26709@psf.upfronthosting.co.za> |
2016-04-07 09:46:22 | serhiy.storchaka | link | issue26709 messages |
2016-04-07 09:46:21 | serhiy.storchaka | create | |
|