mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-11-13 03:37:15 +00:00
python3-pillow: Fix CVE-2026-59198
This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. [1] https://github.com/python-pillow/Pillow/commit/eada3cbd7fb9963ee90673fb7b5270124a0d5f4b [2] https://github.com/python-pillow/Pillow/security/advisories/GHSA-fj7v-r99m-22gq Signed-off-by: Yogita Urade <yurade@cisco.com> Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
This commit is contained in:
1 parent
293c0ee6ef
commit
dbf1a37262
2 files changed
+58
No files matched your search
@@ -0,0 +1,57 @@
|
||||
From 49ea10f3c83475ad30c1b0581e2aaa3e75f4af4f Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Murray <3112309+radarhere@users.noreply.github.com>
|
||||
Date: Tue, 23 Jun 2026 09:46:33 +1000
|
||||
Subject: [PATCH] Prevent saving 1 mode images as TGA with run-length encoding
|
||||
(#9709)
|
||||
|
||||
CVE: CVE-2026-59198
|
||||
Upstream-Status: Backport [https://github.com/python-pillow/Pillow/commit/eada3cbd7fb9963ee90673fb7b5270124a0d5f4b]
|
||||
|
||||
(cherry picked from commit eada3cbd7fb9963ee90673fb7b5270124a0d5f4b)
|
||||
Signed-off-by: Yogita Urade <yurade@cisco.com>
|
||||
---
|
||||
Tests/test_file_tga.py | 12 +++++++++++-
|
||||
src/PIL/TgaImagePlugin.py | 4 ++++
|
||||
2 files changed, 15 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Tests/test_file_tga.py b/Tests/test_file_tga.py
|
||||
index 7ec562342..82bcf48ca 100644
|
||||
--- a/Tests/test_file_tga.py
|
||||
+++ b/Tests/test_file_tga.py
|
||||
@@ -179,10 +179,20 @@ def test_save_wrong_mode(tmp_path: Path) -> None:
|
||||
im = hopper("PA")
|
||||
out = tmp_path / "temp.tga"
|
||||
|
||||
- with pytest.raises(OSError):
|
||||
+ with pytest.raises(OSError, match="cannot write mode PA as TGA"):
|
||||
im.save(out)
|
||||
|
||||
|
||||
+def test_save_1_mode_rle(tmp_path: Path) -> None:
|
||||
+ im = Image.new("1", (1, 1))
|
||||
+ out = tmp_path / "temp.tga"
|
||||
+
|
||||
+ with pytest.raises(
|
||||
+ OSError, match="cannot write mode 1 as TGA with run-length encoding"
|
||||
+ ):
|
||||
+ im.save(out, compression="tga_rle")
|
||||
+
|
||||
+
|
||||
def test_save_mapdepth() -> None:
|
||||
# This image has been manually hexedited from 200x32_p_bl_raw.tga
|
||||
# to include an origin
|
||||
diff --git a/src/PIL/TgaImagePlugin.py b/src/PIL/TgaImagePlugin.py
|
||||
index b2989a4b7..8fd63b1df 100644
|
||||
--- a/src/PIL/TgaImagePlugin.py
|
||||
+++ b/src/PIL/TgaImagePlugin.py
|
||||
@@ -205,6 +205,10 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
|
||||
compression = im.encoderinfo.get("compression", im.info.get("compression"))
|
||||
rle = compression == "tga_rle"
|
||||
if rle:
|
||||
+ if im.mode == "1":
|
||||
+ msg = f"cannot write mode {im.mode} as TGA with run-length encoding"
|
||||
+ raise OSError(msg)
|
||||
+
|
||||
imagetype += 8
|
||||
|
||||
id_section = im.encoderinfo.get("id_section", im.info.get("id_section", ""))
|
||||
@@ -12,6 +12,7 @@ SRC_URI = "git://github.com/python-pillow/Pillow.git;branch=main;protocol=https;
|
||||
file://CVE-2026-54059_CVE-2026-54060_CVE-2026-55379.patch \
|
||||
file://CVE-2026-55380.patch \
|
||||
file://CVE-2026-59197.patch \
|
||||
file://CVE-2026-59198.patch \
|
||||
"
|
||||
SRCREV = "3c41c095064200a02672d89cc5ff629eaf4b0d4f"
|
||||
|
||||
|
||||
Reference in new issue
Block a user