From 975a9eb3a2779683daf6cc93603222905e90164f Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Mon, 10 May 2021 16:11:16 -0700 Subject: [PATCH] Limit toDatetime to 32-bit integer --- plexapi/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plexapi/utils.py b/plexapi/utils.py index be07672e..5fe31caa 100644 --- a/plexapi/utils.py +++ b/plexapi/utils.py @@ -200,9 +200,8 @@ def toDatetime(value, format=None): else: # https://bugs.python.org/issue30684 # And platform support for before epoch seems to be flaky. - # TODO check for others errors too. - if int(value) <= 0: - value = 86400 + # Also limit to max 32-bit integer + value = min(max(int(value), 86400), 2**31 - 1) value = datetime.fromtimestamp(int(value)) return value