aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/python-pillow-CVE-2022-45199.patch
blob: 3b01d3a8f4489df076dfb66a13dd456e41784c57 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 13f2c5ae14901c89c38f898496102afd9daeaf6d Mon Sep 17 00:00:00 2001
From: Eric Soroos <eric-github@soroos.net>
Date: Fri, 28 Oct 2022 14:11:25 +0200
Subject: [PATCH 1/5] Prevent DOS with large SAMPLESPERPIXEL in Tiff IFD

A large value in the SAMPLESPERPIXEL tag could lead to a memory and
runtime DOS in TiffImagePlugin.py when setting up the context for
image decoding.

diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py
index 04a63bd2b44..46166fc6335 100644
--- a/src/PIL/TiffImagePlugin.py
+++ b/src/PIL/TiffImagePlugin.py
@@ -257,6 +257,8 @@
     (MM, 8, (1,), 1, (8, 8, 8), ()): ("LAB", "LAB"),
 }
 
+MAX_SAMPLESPERPIXEL = max(len(key_tp[4]) for key_tp in OPEN_INFO.keys())
+
 PREFIXES = [
     b"MM\x00\x2A",  # Valid TIFF header with big-endian byte order
     b"II\x2A\x00",  # Valid TIFF header with little-endian byte order
@@ -1396,6 +1398,12 @@ def _setup(self):
             SAMPLESPERPIXEL,
             3 if self._compression == "tiff_jpeg" and photo in (2, 6) else 1,
         )
+
+        if samples_per_pixel > MAX_SAMPLESPERPIXEL:
+            # DOS check, samples_per_pixel can be a Long, and we extend the tuple below
+            logger.error("More samples per pixel than can be decoded: %s", samples_per_pixel)
+            raise SyntaxError("Invalid value for samples per pixel")
+
         if samples_per_pixel < bps_actual_count:
             # If a file has more values in bps_tuple than expected,
             # remove the excess.

ore: Ignore generated .pot files....These files are automatically-extracted templates rather than source, hence shouldn't be checked in. * .gitignore: Add a glob pattern to ignore .pot files. Maxim Cournoyer 2020-10-20gitignore: Ignore generated guile binary and intermediate products....* .gitignore: Ignore guile, guile-guile-launcher.o, .deps and .dirstamp. Julien Lepiller 2020-09-17guix-install.sh: Support OpenRC....* etc/guix-install.sh (chk_init_sys): Detect OpenRC. (sys_enable_guix_daemon): Install & enable the Guix daemon on such systems. * etc/openrc/guix-daemon.in: New file. * nix/local.mk: Add a rule for it. (openrcservicedir, nodist_openrcservice_DATA): New variables. (CLEANFILES, EXTRA_DIST): Add them. * .gitignore: Ignore etc/openrc/guix-daemon. Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr> Morgan Smith '>guix system: Remove unused 'read-operating-system' procedure....* guix/scripts/system.scm (read-operating-system): Remove. * gnu/ci.scm: Remove unused (guix scripts system) import. Ludovic Courtès 2022-05-25Move (gnu platform) and (gnu platforms ...) to guix/....* gnu/platform.scm: * gnu/platforms/arm.scm: * gnu/platforms/hurd.scm: * gnu/platforms/mips.scm: * gnu/platforms/powerpc.scm: * gnu/platforms/riscv.scm: * gnu/platforms/s390.scm: * gnu/platforms/x86.scm: Move to guix/. * Makefile.am: * doc/guix.texi (Porting to a New Platform): * etc/release-manifest.scm: * gnu/ci.scm: * gnu/image.scm: * gnu/local.mk: * gnu/packages/bioinformatics.scm: * gnu/packages/bootstrap.scm: * gnu/packages/cross-base.scm: * gnu/packages/instrumentation.scm: * gnu/packages/linux.scm: * gnu/system/image.scm: * gnu/system/images/hurd.scm: * gnu/system/images/novena.scm: * gnu/system/images/pine64.scm: * gnu/system/images/pinebook-pro.scm: * gnu/system/images/rock64.scm: * guix/scripts/build.scm: * guix/scripts/system.scm: * guix/self.scm: Update (gnu platform...) to (guix platform...). Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Josselin Poiret 2022-05-22ci: Do not rely on hardcoded cross-targets lists....* gnu/ci.scm (%cross-targets): Remove it ... (cross-jobs): ... and use the targets procedure instead. * etc/release-manifest.scm: Adapt it. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Mathieu Othacehe 2022-01-01ci: Add extra jobs for tunable packages....This allows us to provide substitutes for tuned package variants. * gnu/ci.scm (package-job): Add #:suffix and honor it. (package->job): Add #:suffix and honor it. (%x86-64-micro-architectures): New variable. (tuned-package-jobs): New procedure. (cuirass-jobs): Add jobs for tunable packages. Ludovic Courtès 2021-12-10Merge remote-tracking branch 'signed/master' into core-updatesMathieu Othacehe 2021-12-06ci: Cross-build the 'guix' package....* gnu/ci.scm (%core-packages): Add GUIX. Ludovic Courtès 2021-10-12Merge remote-tracking branch 'origin/master' into core-updates-frozen.Mathieu Othacehe 2021-10-04ci: Allow manifests to contain any lowerable object....Previously, manifests could only contain packages: https://lists.gnu.org/archive/html/guix-devel/2021-10/msg00002.html This allows us to pass origins as found in 'etc/source-manifest.scm'. * gnu/ci.scm (derivation->job): Change default #:timeout value to 5h. (manifests->packages): Remove. (manifests->jobs): New procedure. (cuirass-jobs): Use it in the 'manifests' case. Ludovic Courtès 2021-09-27ci: Adjust 'channel-build-system' to monadic style....* gnu/ci.scm (channel-build-system): Adjust to new monadic style. Ludovic Courtès 2021-07-10ci: Build commencement packages supported on the target system....This is a followup to df49fe2a13d933c640e3189413c5adfced1103c5. * gnu/ci.scm (%bootstrap-packages): Rename to... (commencement-packages): ... this, and turn into a procedure. Filter packages that pass 'supported-package?'. (cuirass-jobs): Adjust accordingly. Ludovic Courtès 2021-07-09ci: Add bootstrap packages to the core subset....* gnu/ci.scm (%bootstrap-packages): New variable. (cuirass-jobs): Add it to the core subset. Mathieu Othacehe 2021-07-09ci: Add bootstrap packages to the core subset....* gnu/ci.scm (%bootstrap-packages): New variable. (cuirass-jobs): Add it to the core subset. Mathieu Othacehe 2021-07-05ci: Change "core" subset to include the latest GCC and Guile....* gnu/ci.scm (%core-packages): Replace GCC-7 by GCC-11 and GUILE-2.0 by GUILE-3.0. Ludovic Courtès 2021-07-03ci: Remove duplicate ".SYSTEM" extension for cross-compilation jobs....* gnu/ci.scm (package-cross-job): Remove ".SYSTEM". Ludovic Courtès