Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-backports.zstd for 
openSUSE:Factory checked in at 2026-11-20 14:43:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-backports.zstd (Old)
 and      /work/SRC/openSUSE:Factory/.python-backports.zstd.new.1251 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-backports.zstd"

Fri Nov 20 14:43:42 2026 rev:7 rq:1398241 version:1.8.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-backports.zstd/python-backports.zstd.changes  
    2026-09-12 21:15:59.572078187 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-backports.zstd.new.1251/python-backports.zstd.changes
    2026-11-20 14:44:12.760010874 +0100
@@ -1,0 +2,6 @@
+Tue Nov 17 17:18:59 UTC 2026 - Dirk Müller <[email protected]>
+
+- update to 1.8.0 (CVE-2026-82049):
+  * Update code with CPython 3.14.8 version
+
+-------------------------------------------------------------------
@@ -4 +10 @@
-- update to 1.7.0
+- update to 1.7.0 (CVE-2026-11940):

Old:
----
  backports_zstd-1.7.0.tar.gz

New:
----
  backports_zstd-1.8.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-backports.zstd.spec ++++++
--- /var/tmp/diff_new_pack.AQf1J8/_old  2026-11-20 14:44:15.877142247 +0100
+++ /var/tmp/diff_new_pack.AQf1J8/_new  2026-11-20 14:44:15.881142416 +0100
@@ -21,7 +21,7 @@
 %define skip_python315 1
 %{?sle15_python_module_pythons}
 Name:           python-backports.zstd
-Version:        1.7.0
+Version:        1.8.0
 Release:        0
 Summary:        Backport of compressionzstd
 License:        BSD-3-Clause

++++++ backports_zstd-1.7.0.tar.gz -> backports_zstd-1.8.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/backports_zstd-1.7.0/PKG-INFO 
new/backports_zstd-1.8.0/PKG-INFO
--- old/backports_zstd-1.7.0/PKG-INFO   2026-08-15 18:14:35.708436300 +0200
+++ new/backports_zstd-1.8.0/PKG-INFO   2026-10-10 17:10:25.451659400 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.4
 Name: backports.zstd
-Version: 1.7.0
+Version: 1.8.0
 Summary: Backport of compression.zstd
 Author-email: Rogdham <[email protected]>
 License-Expression: PSF-2.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/backports_zstd-1.7.0/pyproject.toml 
new/backports_zstd-1.8.0/pyproject.toml
--- old/backports_zstd-1.7.0/pyproject.toml     2026-08-15 18:14:26.003348400 
+0200
+++ new/backports_zstd-1.8.0/pyproject.toml     2026-10-10 17:10:18.954432200 
+0200
@@ -1,6 +1,6 @@
 [project]
 name = "backports.zstd"
-version = "1.7.0"
+version = "1.8.0"
 authors = [{ name = "Rogdham", email = "[email protected]" }]
 description = "Backport of compression.zstd"
 readme = { file = "README.md", content-type = "text/markdown" }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/backports_zstd-1.7.0/src/python/backports/zstd/tarfile.py 
new/backports_zstd-1.8.0/src/python/backports/zstd/tarfile.py
--- old/backports_zstd-1.7.0/src/python/backports/zstd/tarfile.py       
2026-08-15 18:14:26.005464600 +0200
+++ new/backports_zstd-1.8.0/src/python/backports/zstd/tarfile.py       
2026-10-10 17:10:18.956531300 +0200
@@ -827,6 +827,13 @@
         # For example, 'C:/foo' on Windows.
         raise AbsolutePathError(member)
     # Ensure we stay in the destination
+    if '..' in name.replace(os.sep, '/').split('/'):
+        # Directories are created from the name as given, so a name that
+        # leaves the destination part-way through would create them
+        # outside it even if the resolved path stays inside.
+        normalized = os.path.normpath(name)
+        if normalized != name:
+            name = new_attrs['name'] = normalized
     target_path = 
_backportszstd_os_path_realpath_allow_missing(os.path.join(dest_path, name))
     if os.path.commonpath([target_path, dest_path]) != dest_path:
         raise OutsideDestinationError(member, target_path)
@@ -1622,17 +1629,22 @@
         if self.type in (XHDTYPE, SOLARIS_XHDTYPE):
             # Patch the TarInfo object with the extended header info.
             next._apply_pax_info(pax_headers, tarfile.encoding, tarfile.errors)
-            next.offset = self.offset
 
             if "size" in pax_headers:
                 # If the extended header replaces the size field,
                 # we need to recalculate the offset where the next
                 # header starts.
-                offset = next.offset_data
+                offset = next.offset + BLOCKSIZE
                 if next.isreg() or next.type not in SUPPORTED_TYPES:
-                    offset += next._block(next.size)
+                    try:
+                        size = PAX_NUMBER_FIELDS["size"](pax_headers["size"])
+                    except ValueError:
+                        size = 0
+                    offset += next._block(size)
                 tarfile.offset = offset
 
+            next.offset = self.offset
+
         return next
 
     def _proc_gnusparse_00(self, next, raw_headers):
@@ -2792,7 +2804,11 @@
                     if os.path.lexists(targetpath):
                         # Avoid FileExistsError on following os.link.
                         os.unlink(targetpath)
-                    os.link(tarinfo._link_target, targetpath)
+                    # Resolve the target so the hard link points to the file
+                    # itself. Otherwise os.link() may duplicate a symlink to a
+                    # shallower location, where its relative target escapes the
+                    # destination directory. (CVE-2026-82049)
+                    os.link(os.path.realpath(tarinfo._link_target), targetpath)
                     return
         except symlink_exception:
             keyerror_to_extracterror = True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/backports_zstd-1.7.0/src/python/backports/zstd/tarfile.pyi 
new/backports_zstd-1.8.0/src/python/backports/zstd/tarfile.pyi
--- old/backports_zstd-1.7.0/src/python/backports/zstd/tarfile.pyi      
2026-08-15 18:14:26.005656200 +0200
+++ new/backports_zstd-1.8.0/src/python/backports/zstd/tarfile.pyi      
2026-10-10 17:10:18.956531300 +0200
@@ -1,6 +1,6 @@
 import bz2
 import io
-from _typeshed import ReadableBuffer, StrOrBytesPath, StrPath, SupportsRead, 
WriteableBuffer
+from _typeshed import FileDescriptorOrPath, ReadableBuffer, StrOrBytesPath, 
StrPath, SupportsRead, WriteableBuffer
 from builtins import list as _list  # aliases to avoid name clashes with 
fields named "type" or "list"
 from collections.abc import Callable, Iterable, Iterator, Mapping
 from gzip import _ReadableFileobj as _GzipReadableFileobj, _WritableFileobj as 
_GzipWritableFileobj
@@ -289,7 +289,7 @@
         pax_headers: Mapping[str, str] | None = ...,
         debug: Literal[0, 1, 2, 3] | None = None,  # default 0
         errorlevel: Literal[0, 1, 2] | None = None,  # default 1
-        preset: Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | None = ...,
+        preset: int | None = ...,
     ) -> Self: ...
     @overload
     @classmethod
@@ -309,7 +309,7 @@
         pax_headers: Mapping[str, str] | None = ...,
         debug: Literal[0, 1, 2, 3] | None = None,  # default 0
         errorlevel: Literal[0, 1, 2] | None = None,  # default 1
-        preset: Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | None = ...,
+        preset: int | None = ...,
     ) -> Self: ...
     @overload
     @classmethod
@@ -685,7 +685,7 @@
 
 open = TarFile.open
 
-def is_tarfile(name: StrOrBytesPath | IO[bytes]) -> bool: ...
+def is_tarfile(name: FileDescriptorOrPath | IO[bytes]) -> bool: ...
 
 class TarError(Exception): ...
 class ReadError(TarError): ...
@@ -745,7 +745,6 @@
         "_link_target",
     )
     name: str
-    path: str
     size: int
     mtime: int | float
     chksum: int
@@ -777,6 +776,11 @@
     def fromtarfile(cls, tarfile: TarFile) -> Self: ...
 
     @property
+    def path(self) -> str: ...
+    @path.setter
+    def path(self, name: str) -> None: ...
+
+    @property
     def linkpath(self) -> str: ...
     @linkpath.setter
     def linkpath(self, linkname: str) -> None: ...
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/backports_zstd-1.7.0/src/python/backports/zstd/zipfile/__init__.py 
new/backports_zstd-1.8.0/src/python/backports/zstd/zipfile/__init__.py
--- old/backports_zstd-1.7.0/src/python/backports/zstd/zipfile/__init__.py      
2026-08-15 18:14:26.005656200 +0200
+++ new/backports_zstd-1.8.0/src/python/backports/zstd/zipfile/__init__.py      
2026-10-10 17:10:18.957423700 +0200
@@ -784,7 +784,16 @@
         self._unconsumed = b''
         self.eof = False
 
-    def decompress(self, data):
+    @property
+    def needs_input(self):
+        # While the LZMA properties header is still being buffered, more input
+        # is required; afterwards defer to the wrapped decompressor so a 
bounded
+        # decompress() call can be drained across reads.
+        if self._decomp is None:
+            return True
+        return self._decomp.needs_input
+
+    def decompress(self, data, max_length=-1):
         if self._decomp is None:
             self._unconsumed += data
             if len(self._unconsumed) <= 4:
@@ -800,7 +809,7 @@
             data = self._unconsumed[4 + psize:]
             del self._unconsumed
 
-        result = self._decomp.decompress(data)
+        result = self._decomp.decompress(data, max_length)
         self.eof = self._decomp.eof
         return result
 
@@ -1167,8 +1176,15 @@
             data = self._decompressor.unconsumed_tail
             if n > len(data):
                 data += self._read2(n - len(data))
-        else:
+        elif self._compress_type == ZIP_STORED:
             data = self._read2(n)
+        else:
+            # bzip2/lzma/zstd: a bounded decompress() call may leave input
+            # buffered inside the decompressor; drain that before reading more.
+            if getattr(self._decompressor, "needs_input", True):
+                data = self._read2(n)
+            else:
+                data = b''
 
         if self._compress_type == ZIP_STORED:
             self._eof = self._compress_left <= 0
@@ -1181,8 +1197,17 @@
             if self._eof:
                 data += self._decompressor.flush()
         else:
-            data = self._decompressor.decompress(data)
-            self._eof = self._decompressor.eof or self._compress_left <= 0
+            # Bound the output of a single decompress() call (mirroring the
+            # DEFLATE path above) so that a small compressed member cannot
+            # expand into one unbounded read.
+            try:
+                data = self._decompressor.decompress(data, max(n, 
self.MIN_READ_SIZE))
+            except TypeError:
+                # See MonkeypatchedDecompressorTests in test_core.py
+                data = self._decompressor.decompress(data)
+            self._eof = (self._decompressor.eof or
+                         self._compress_left <= 0 and
+                         getattr(self._decompressor, "needs_input", True))
 
         data = data[:self._left]
         self._left -= len(data)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/backports_zstd-1.7.0/src/python/backports/zstd/zipfile/__init__.pyi 
new/backports_zstd-1.8.0/src/python/backports/zstd/zipfile/__init__.pyi
--- old/backports_zstd-1.7.0/src/python/backports/zstd/zipfile/__init__.pyi     
2026-08-15 18:14:26.007081700 +0200
+++ new/backports_zstd-1.8.0/src/python/backports/zstd/zipfile/__init__.pyi     
2026-10-10 17:10:18.957423700 +0200
@@ -1,5 +1,5 @@
 import io
-from _typeshed import SizedBuffer, StrOrBytesPath, StrPath
+from _typeshed import FileDescriptorOrPath, SizedBuffer, StrPath
 from collections.abc import Callable, Iterable, Iterator
 from io import TextIOWrapper
 from os import PathLike
@@ -275,7 +275,7 @@
 
 from zipfile._path import CompleteDirs as CompleteDirs, Path as Path
 
-def is_zipfile(filename: StrOrBytesPath | _SupportsReadSeekTell) -> bool: ...
+def is_zipfile(filename: FileDescriptorOrPath | _SupportsReadSeekTell) -> 
bool: ...
 
 ZIP64_LIMIT: Final[int]
 ZIP_FILECOUNT_LIMIT: Final[int]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/backports_zstd-1.7.0/src/python/backports.zstd.egg-info/PKG-INFO 
new/backports_zstd-1.8.0/src/python/backports.zstd.egg-info/PKG-INFO
--- old/backports_zstd-1.7.0/src/python/backports.zstd.egg-info/PKG-INFO        
2026-08-15 18:14:35.629517300 +0200
+++ new/backports_zstd-1.8.0/src/python/backports.zstd.egg-info/PKG-INFO        
2026-10-10 17:10:25.367231800 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.4
 Name: backports.zstd
-Version: 1.7.0
+Version: 1.8.0
 Summary: Backport of compression.zstd
 Author-email: Rogdham <[email protected]>
 License-Expression: PSF-2.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/backports_zstd-1.7.0/tests/test/support/__init__.py 
new/backports_zstd-1.8.0/tests/test/support/__init__.py
--- old/backports_zstd-1.7.0/tests/test/support/__init__.py     2026-08-15 
18:14:26.007819200 +0200
+++ new/backports_zstd-1.8.0/tests/test/support/__init__.py     2026-10-10 
17:10:18.959423800 +0200
@@ -984,16 +984,29 @@
     def decorator(func):
         if isinstance(func, type):
             raise TypeError('subTests() can only decorate methods, not 
classes')
-        @functools.wraps(func)
-        def wrapper(self, /, *args, **kwargs):
+
+        def iter_subtest_kwargs():
             for values in arg_values:
-                if single_param:
-                    values = (values,)
-                subtest_kwargs = dict(zip(arg_names, values))
-                with self.subTest(**subtest_kwargs):
-                    func(self, *args, **kwargs, **subtest_kwargs)
-                if _do_cleanups:
-                    self.doCleanups()
+                yield dict(zip(arg_names, (values,) if single_param else 
values))
+
+        # A synchronous wrapper would discard the coroutine without awaiting
+        # it, so an asynchronous test would not run at all.
+        if inspect.iscoroutinefunction(func):
+            @functools.wraps(func)
+            async def wrapper(self, /, *args, **kwargs):
+                for subtest_kwargs in iter_subtest_kwargs():
+                    with self.subTest(**subtest_kwargs):
+                        await func(self, *args, **kwargs, **subtest_kwargs)
+                    if _do_cleanups:
+                        self.doCleanups()
+        else:
+            @functools.wraps(func)
+            def wrapper(self, /, *args, **kwargs):
+                for subtest_kwargs in iter_subtest_kwargs():
+                    with self.subTest(**subtest_kwargs):
+                        func(self, *args, **kwargs, **subtest_kwargs)
+                    if _do_cleanups:
+                        self.doCleanups()
         return wrapper
     return decorator
 
@@ -1189,6 +1202,7 @@
     test doesn't support dummy runs when -M is not specified.
     """
     def decorator(f):
+        @functools.wraps(f)
         def wrapper(self):
             size = wrapper.size
             memuse = wrapper.memuse
@@ -1241,6 +1255,7 @@
 
 def bigaddrspacetest(f):
     """Decorator for tests that fill the address space."""
+    @functools.wraps(f)
     def wrapper(self):
         if max_memuse < MAX_Py_ssize_t:
             if MAX_Py_ssize_t >= 2**63 - 1 and max_memuse >= 2**31:
@@ -1346,6 +1361,7 @@
     def deco(func):
         assert not isinstance(func, type), func
         _has_run = False
+        @functools.wraps(func)
         def wrapper(self):
             nonlocal _has_run
             if _has_run:
@@ -1448,14 +1464,25 @@
 # to cleanup threads.
 environment_altered = False
 
+# Short descriptions of what was altered, e.g. "unraisable exception".
+# They are reported by regrtest together with the name of the test.
+environment_altered_reasons = []
+
+
+def set_environment_altered(reason):
+    """Set the environment_altered flag and record why it was set."""
+    global environment_altered
+    environment_altered = True
+    if reason not in environment_altered_reasons:
+        environment_altered_reasons.append(reason)
+
+
 def reap_children():
     """Use this function at the end of test_main() whenever sub-processes
     are started.  This will help ensure that no extra children (zombies)
     stick around to hog resources and create problems when looking
     for refleaks.
     """
-    global environment_altered
-
     # Need os.waitpid(-1, os.WNOHANG): Windows is not supported
     if not (hasattr(os, 'waitpid') and hasattr(os, 'WNOHANG')):
         return
@@ -1475,7 +1502,7 @@
             break
 
         print_warning(f"reap_children() reaped child process {pid}")
-        environment_altered = True
+        set_environment_altered("reaped child process")
 
 
 @contextlib.contextmanager
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/backports_zstd-1.7.0/tests/test/support/os_helper.py 
new/backports_zstd-1.8.0/tests/test/support/os_helper.py
--- old/backports_zstd-1.7.0/tests/test/support/os_helper.py    2026-08-15 
18:14:26.009343900 +0200
+++ new/backports_zstd-1.8.0/tests/test/support/os_helper.py    2026-10-10 
17:10:18.960464200 +0200
@@ -3,6 +3,7 @@
 import errno
 import logging
 import os
+import platform
 import re
 import stat
 import string
@@ -433,7 +434,19 @@
                           file=sys.__stderr__)
                     mode = 0
                 if stat.S_ISDIR(mode):
-                    _waitfor(_rmtree_inner, fullname, waitall=True)
+                    if sys.version_info >= (3, 12) and not (
+                        # https://github.com/pypy/pypy/issues/5626
+                        sys.version_info[:2] == (3, 12)
+                        and platform.python_implementation() == "PyPy"
+                    ):
+                        # Do not follow junctions, which os.lstat() reports
+                        # as directories.
+                        if not os.path.isjunction(fullname):
+                            _waitfor(_rmtree_inner, fullname, waitall=True)
+                    else:
+                        # isjuction does not exist before Python 3.12
+                        # fallback to code of version 3.14.7
+                        _waitfor(_rmtree_inner, fullname, waitall=True)
                     _force_run(fullname, os.rmdir, fullname)
                 else:
                     _force_run(fullname, os.unlink, fullname)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/backports_zstd-1.7.0/tests/test/test_tarfile.py 
new/backports_zstd-1.8.0/tests/test/test_tarfile.py
--- old/backports_zstd-1.7.0/tests/test/test_tarfile.py 2026-08-15 
18:14:26.009343900 +0200
+++ new/backports_zstd-1.8.0/tests/test/test_tarfile.py 2026-10-10 
17:10:18.960464200 +0200
@@ -1379,6 +1379,37 @@
     def test_sparse_file_10(self):
         self._test_sparse_file("gnu/sparse-1.0")
 
+    def test_sparse_file_10_pax_size(self):
+        # gh-83869: when the pax header replaces the size field, the offset
+        # of the next header must be computed from the size of the data in
+        # the archive, not from the apparent size of the sparse file.
+        data = b"payload!" * 4
+        realsize = 1 << 20
+        smap = b"1\n%d\n%d\n" % (realsize - len(data), len(data))
+        smap += b"\0" * (-len(smap) % tarfile.BLOCKSIZE)
+
+        sparse = tarfile.TarInfo("sparse")
+        sparse.size = len(smap) + len(data)
+        sparse.pax_headers = {
+            "GNU.sparse.major": "1",
+            "GNU.sparse.minor": "0",
+            "GNU.sparse.name": "sparse",
+            "GNU.sparse.realsize": str(realsize),
+            "size": str(sparse.size),
+        }
+        buf = sparse.tobuf(tarfile.PAX_FORMAT)
+        buf += smap + data + b"\0" * (-len(data) % tarfile.BLOCKSIZE)
+
+        last = tarfile.TarInfo("last")
+        last.size = len(data)
+        buf += last.tobuf(tarfile.PAX_FORMAT)
+        buf += data + b"\0" * (-len(data) % tarfile.BLOCKSIZE)
+        buf += b"\0" * (tarfile.BLOCKSIZE * 2)
+
+        with tarfile.open(fileobj=io.BytesIO(buf)) as tar:
+            self.assertEqual(tar.getnames(), ["sparse", "last"])
+            self.assertEqual(tar.extractfile("last").read(), data)
+
     @staticmethod
     def _fs_supports_holes():
         # Return True if the platform knows the st_blocks stat attribute and
@@ -1431,6 +1462,31 @@
         finally:
             tar.close()
 
+    def test_offset_after_global_header(self):
+        # gh-83869: a global header is a member of its own, the member which
+        # follows it keeps the offset of its own header.
+        rec = b"30 comment=global header here\n"
+        glob = tarfile.TarInfo("././@PaxHeader")
+        glob.type = tarfile.XGLTYPE
+        glob.size = len(rec)
+        buf = glob.tobuf(tarfile.USTAR_FORMAT)
+        buf += rec + b"\0" * (-len(rec) % tarfile.BLOCKSIZE)
+
+        member = tarfile.TarInfo("member")
+        data = b"hello\n"
+        member.size = len(data)
+        offset = len(buf)
+        buf += member.tobuf(tarfile.USTAR_FORMAT)
+        buf += data + b"\0" * (-len(data) % tarfile.BLOCKSIZE)
+        buf += b"\0" * (tarfile.BLOCKSIZE * 2)
+
+        with tarfile.open(fileobj=io.BytesIO(buf)) as tar:
+            tarinfo = tar.getmember("member")
+            self.assertEqual(tarinfo.offset, offset)
+            self.assertEqual(tarinfo.pax_headers.get("comment"),
+                             "global header here")
+            self.assertEqual(tar.extractfile(tarinfo).read(), data)
+
     def test_pax_number_fields(self):
         # All following number fields are read from the pax header.
         tar = tarfile.open(tarname, encoding="iso8859-1")
@@ -3941,6 +3997,20 @@
                         tarfile.AbsolutePathError,
                         """['"].*escaped.evil['"] has an absolute path""")
 
+    def test_parent_dir_out_and_back(self):
+        # Test a member that leaves the destination and comes back.
+        # The containment check looks at the resolved path, which stays
+        # inside, but the intermediate directories are created from the
+        # name as given, which does not.
+        with ArchiveMaker() as arc:
+            arc.add(f'../escaped.evil/../{self.destdir.name}/sub/file',
+                    content='content')
+
+        for filter in 'tar', 'data':
+            with self.subTest(filter):
+                with self.check_context(arc.open(), filter):
+                    self.expect_file('sub/file', content='content')
+
     @symlink_test
     def test_parent_symlink(self):
         # Test interplaying symlinks
@@ -4434,6 +4504,24 @@
                     self.expect_file("s", symlink_to=os.path.join('..', 
'escape'))
 
     @symlink_test
+    @os_helper.skip_unless_hardlink
+    def test_sneaky_hardlink_relocation(self):
+        with ArchiveMaker() as arc:
+            arc.add("a/escape", content="decoy")
+            arc.add("a/b/s", symlink_to=os.path.join("..", "escape"))
+            arc.add("s", hardlink_to=os.path.join("a", "b", "s"))
+
+        for filter in 'data', 'tar':
+            with self.subTest(filter), self.check_context(arc.open(), filter):
+                self.expect_file("a/escape", content="decoy")
+                if os_helper.can_symlink():
+                    self.expect_file("a/b/s", symlink_to=os.path.join('..', 
'escape'))
+                else:
+                    self.expect_file("a/b/s", content="decoy")
+                self.expect_file("s", content="decoy")
+                self.assertFalse((self.destdir / "s").is_symlink())
+
+    @symlink_test
     def test_exfiltration_via_symlink(self):
         # (CVE-2025-4138)
         # Test changing symlinks that result in a symlink pointing outside
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/backports_zstd-1.7.0/tests/test/test_zipfile/test_core.py 
new/backports_zstd-1.8.0/tests/test/test_zipfile/test_core.py
--- old/backports_zstd-1.7.0/tests/test/test_zipfile/test_core.py       
2026-08-15 18:14:26.010631600 +0200
+++ new/backports_zstd-1.8.0/tests/test/test_zipfile/test_core.py       
2026-10-10 17:10:18.961734000 +0200
@@ -2722,6 +2722,123 @@
         unlink(TESTFN2)
 
 
+class AbstractBoundedDecompressTests:
+    # ZipExtFile._read1() bounds the output of each decompress() call so that a
+    # small member declaring a large uncompressed size cannot expand into one
+    # unbounded read.
+    def test_read1_output_is_bounded(self):
+        buf = io.BytesIO()
+        with zipfile.ZipFile(buf, "w", compression=self.compression) as zf:
+            zf.writestr("big", b"\0" * (4 * 1024 * 1024))
+        with zipfile.ZipFile(io.BytesIO(buf.getvalue())) as zf:
+            with zf.open("big") as f:
+                self.assertLessEqual(len(f._read1(100)), f.MIN_READ_SIZE)
+
+
+class StoredBoundedDecompressTests(AbstractBoundedDecompressTests,
+                                   unittest.TestCase):
+    compression = zipfile.ZIP_STORED
+
+
+@requires_zlib()
+class DeflateBoundedDecompressTests(AbstractBoundedDecompressTests,
+                                    unittest.TestCase):
+    compression = zipfile.ZIP_DEFLATED
+
+
+@requires_bz2()
+class Bzip2BoundedDecompressTests(AbstractBoundedDecompressTests,
+                                  unittest.TestCase):
+    compression = zipfile.ZIP_BZIP2
+
+
+@requires_lzma()
+class LzmaBoundedDecompressTests(AbstractBoundedDecompressTests,
+                                 unittest.TestCase):
+    compression = zipfile.ZIP_LZMA
+
+
+@requires_zstd()
+class ZstdBoundedDecompressTests(AbstractBoundedDecompressTests,
+                                 unittest.TestCase):
+    compression = zipfile.ZIP_ZSTANDARD
+
+
+class MonkeypatchedDecompressorTests(unittest.TestCase):
+    # Some third-party projects monkey-patch _get_decompressor() to add
+    # additional compression schemes. This can break at any time as the
+    # internal compressor objects change.
+    # To protect users, we try to keep this case working.
+    # See also: GH-156002 and GH-113767.
+    COMPRESSION = 99
+
+    def _enterContext(self, cm):
+        if sys.version_info >= (3, 11):
+            return self.enterContext(cm)
+        cls = type(cm)
+        result = cls.__enter__(cm)
+        self.addCleanup(cls.__exit__, cm, None, None, None)
+        return result
+
+    class Compressor:
+        """Compressor with only the original BZ2Compressor API"""
+        def compress(self, data):
+            return data.swapcase()
+
+        def flush(self):
+            return b''
+
+    class Decompressor:
+        """Decompressor with only the 3.3+ BZ2Decompressor API"""
+        eof = False
+
+        def decompress(self, data):
+            return data.swapcase()
+
+    def setUp(self):
+        orig_check_compression = zipfile._check_compression
+        orig_get_compressor = zipfile._get_compressor
+        orig_get_decompressor = zipfile._get_decompressor
+
+        def check_compression(compression):
+            if compression != self.COMPRESSION:
+                orig_check_compression(compression)
+
+        def get_compressor(compress_type, compresslevel=None):
+            if compress_type == self.COMPRESSION:
+                return self.Compressor()
+            return orig_get_compressor(compress_type, compresslevel)
+
+        def get_decompressor(compress_type):
+            if compress_type == self.COMPRESSION:
+                return self.Decompressor()
+            return orig_get_decompressor(compress_type)
+
+        self._enterContext(mock.patch.object(
+            zipfile, '_check_compression', check_compression))
+        self._enterContext(mock.patch.object(
+            zipfile, '_get_compressor', get_compressor))
+        self._enterContext(mock.patch.object(
+            zipfile, '_get_decompressor', get_decompressor))
+
+    def test_roundtrip_monkeypatched_decompressor(self):
+        data = bytes(range(256)) * 8
+        buf = io.BytesIO()
+        with zipfile.ZipFile(buf, "w", compression=self.COMPRESSION) as zf:
+            zf.writestr("member", data)
+        self.assertIn(data.swapcase(), buf.getvalue())
+        with zipfile.ZipFile(io.BytesIO(buf.getvalue())) as zf:
+            self.assertEqual(zf.read("member"), data)
+            with zf.open("member") as f:
+                self.assertEqual(f.read(100), data[:100])
+                self.assertEqual(f.read1(100), data[100:200])
+                f.seek(-100, os.SEEK_END)
+                self.assertEqual(f.read(), data[-100:])
+                # Rewinding past the read buffer re-creates the decompressor.
+                f.seek(0)
+                self.assertEqual(f.read(), data)
+
+
 class AbstractBadCrcTests:
     def test_testzip_with_bad_crc(self):
         """Tests that files with bad CRCs return their name from testzip."""

Reply via email to