New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Year 2038 problem in plistlib #70896
Comments
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. |
Patch looks good to me. |
New changeset ba35b0404163 by Serhiy Storchaka in branch '3.5': New changeset 778ccbe3cf74 by Serhiy Storchaka in branch 'default': |
Thanks Ronald. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: