public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Sandro Mani <manisandro@gmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/python-pillow] f44: Backport fix for CVE-2026-112892
Date: Mon, 26 Oct 2026 21:52:20 GMT	[thread overview]
Message-ID: <179305154077.1.11408658534139484848.rpms-python-pillow-d39ca781e43e@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/python-pillow
Branch : f44
Commit : d39ca781e43e7e9eaada815fff8d0d225c3e0944
Author : Sandro Mani <manisandro@gmail.com>
Date   : 2026-10-26T22:51:16+01:00
Stats  : +60/-3 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/python-pillow/c/d39ca781e43e7e9eaada815fff8d0d225c3e0944?branch=f44

Log:
Backport fix for CVE-2026-112892

---
diff --git a/CVE-2026-112892.patch b/CVE-2026-112892.patch
new file mode 100644
index 0000000..69e0809
--- /dev/null
+++ b/CVE-2026-112892.patch
@@ -0,0 +1,51 @@
+diff -rupN --no-dereference Pillow-12.3.0/src/PIL/MspImagePlugin.py Pillow-12.3.0-new/src/PIL/MspImagePlugin.py
+--- Pillow-12.3.0/src/PIL/MspImagePlugin.py	2026-07-01 11:09:01.000000000 +0200
++++ Pillow-12.3.0-new/src/PIL/MspImagePlugin.py	2026-10-26 22:38:23.183448785 +0100
+@@ -115,7 +115,7 @@ class MspDecoder(ImageFile.PyDecoder):
+     def decode(self, buffer: Image.DecoderInput) -> tuple[int, int]:
+         assert self.fd is not None
+ 
+-        img = io.BytesIO()
++        data = bytearray()
+         blank_line = bytearray((0xFF,) * ((self.state.xsize + 7) // 8))
+         try:
+             self.fd.seek(32)
+@@ -129,30 +129,33 @@ class MspDecoder(ImageFile.PyDecoder):
+         for x, rowlen in enumerate(rowmap):
+             try:
+                 if rowlen == 0:
+-                    img.write(blank_line)
++                    data += blank_line
+                     continue
+                 row = self.fd.read(rowlen)
+                 if len(row) != rowlen:
+                     msg = f"Truncated MSP file, expected {rowlen} bytes on row {x}"
+                     raise OSError(msg)
+                 idx = 0
++                row_data = bytearray()
+                 while idx < rowlen:
+                     runtype = row[idx]
+                     idx += 1
+                     if runtype == 0:
+                         runcount, runval = struct.unpack_from("Bc", row, idx)
+-                        img.write(runval * runcount)
++                        runcount = min(runcount, self.state.xsize - len(row_data))
++                        row_data += runval * runcount
+                         idx += 2
+                     else:
+-                        runcount = runtype
+-                        img.write(row[idx : idx + runcount])
++                        runcount = min(runtype, self.state.xsize - len(row_data))
++                        row_data += row[idx : idx + runcount]
+                         idx += runcount
++                data += row_data
+ 
+             except struct.error as e:
+                 msg = f"Corrupted MSP file in row {x}"
+                 raise OSError(msg) from e
+ 
+-        self.set_as_raw(img.getvalue(), "1")
++        self.set_as_raw(bytes(data), "1")
+ 
+         return -1, 0
+ 

diff --git a/pillow_mingw.patch b/pillow_mingw.patch
index bd2885a..62c01b6 100644
--- a/pillow_mingw.patch
+++ b/pillow_mingw.patch
@@ -1,6 +1,6 @@
 diff -rupN --no-dereference Pillow-12.3.0/setup.py Pillow-12.3.0-new/setup.py
 --- Pillow-12.3.0/setup.py	2026-07-01 11:09:01.000000000 +0200
-+++ Pillow-12.3.0-new/setup.py	2026-07-02 07:14:06.100321491 +0200
++++ Pillow-12.3.0-new/setup.py	2026-10-26 22:38:23.040439748 +0100
 @@ -17,7 +17,6 @@ import sys
  import warnings
  from collections.abc import Iterator
@@ -93,7 +93,7 @@ diff -rupN --no-dereference Pillow-12.3.0/setup.py Pillow-12.3.0-new/setup.py
  
 diff -rupN --no-dereference Pillow-12.3.0/src/libImaging/ImPlatform.h Pillow-12.3.0-new/src/libImaging/ImPlatform.h
 --- Pillow-12.3.0/src/libImaging/ImPlatform.h	2026-07-01 11:09:01.000000000 +0200
-+++ Pillow-12.3.0-new/src/libImaging/ImPlatform.h	2026-07-02 07:14:06.100768096 +0200
++++ Pillow-12.3.0-new/src/libImaging/ImPlatform.h	2026-10-26 22:38:23.040797195 +0100
 @@ -29,7 +29,7 @@
  #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
  

diff --git a/python-pillow.spec b/python-pillow.spec
index a333e95..7cd7463 100644
--- a/python-pillow.spec
+++ b/python-pillow.spec
@@ -18,7 +18,7 @@
 
 Name:           python-%{srcname}
 Version:        12.3.0
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Python image processing library
 
 # License: see http://www.pythonware.com/products/pil/license.htm
@@ -28,6 +28,9 @@ Source0:        https://github.com/python-pillow/Pillow/archive/%{version}/Pillo
 
 # MinGW build fixes
 Patch0:         pillow_mingw.patch
+# Backport fix for CVE-2026-112892
+# https://github.com/python-pillow/Pillow/commit/5dcb630b9798efd91929cb873d677aeee6ed0bb3
+Patch1:         CVE-2026-112892.patch
 
 BuildRequires:  freetype-devel
 BuildRequires:  gcc
@@ -307,6 +310,9 @@ popd
 
 
 %changelog
+* Mon Oct 26 2026 Sandro Mani <manisandro@gmail.com> - 12.3.0-4
+- Backport fix for CVE-2026-112892
+
 * Wed Jul 22 2026 Python Maint <python-maint@redhat.com> - 12.3.0-3
 - Rebuilt for Python 3.15.0b4 ABI change
 

                 reply	other threads:[~2026-10-26 21:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179305154077.1.11408658534139484848.rpms-python-pillow-d39ca781e43e@fedoraproject.org \
    --to=manisandro@gmail.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox