public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-pillow] f45: Backport fix for CVE-2026-112892
@ 2026-10-26 21:51 Sandro Mani
  0 siblings, 0 replies; only message in thread
From: Sandro Mani @ 2026-10-26 21:51 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/python-pillow
Branch : f45
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=f45

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
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-26 21:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 21:51 [rpms/python-pillow] f45: Backport fix for CVE-2026-112892 Sandro Mani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox