summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorPetr Viktorin <encukou@gmail.com>2023-08-23 18:00:07 (GMT)
committerGitHub <noreply@github.com>2023-08-23 18:00:07 (GMT)
commit5d1871576500adc4ebaa7f59b8559605a57ad36b (patch)
tree29abab9a38d23e0f27e520f9319c2d1c18a8bfed /Lib/tarfile.py
parent72119d16a5f658939809febef29dadeca02cf34d (diff)
downloadcpython-5d1871576500adc4ebaa7f59b8559605a57ad36b.zip
cpython-5d1871576500adc4ebaa7f59b8559605a57ad36b.tar.gz
cpython-5d1871576500adc4ebaa7f59b8559605a57ad36b.tar.bz2
gh-107811: tarfile: treat overflow in UID/GID as failure to set it (#108369)
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-xLib/tarfile.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index a835d00..726f9f5 100755
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -2557,7 +2557,8 @@ class TarFile(object):
os.lchown(targetpath, u, g)
else:
os.chown(targetpath, u, g)
- except OSError as e:
+ except (OSError, OverflowError) as e:
+ # OverflowError can be raised if an ID doesn't fit in `id_t`
raise ExtractError("could not change owner") from e
def chmod(self, tarinfo, targetpath):