public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-PyMuPDF] rawhide: fix CVE-2026-120752 (rhbz#2567075) (rhbz#2567076)
@ 2026-11-04 20:11 Michael J Gruber
0 siblings, 0 replies; only message in thread
From: Michael J Gruber @ 2026-11-04 20:11 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-PyMuPDF
Branch : rawhide
Commit : 1b7df1fcae643df9fddfab75b8126386dbd417ca
Author : Michael J Gruber <mjg@fedoraproject.org>
Date : 2026-11-04T17:43:03+01:00
Stats : +91/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/python-PyMuPDF/c/1b7df1fcae643df9fddfab75b8126386dbd417ca?branch=rawhide
Log:
fix CVE-2026-120752 (rhbz#2567075) (rhbz#2567076)
---
diff --git a/0001-src-extra.i-tests-test_annots.py-fix-potential-segv-.patch b/0001-src-extra.i-tests-test_annots.py-fix-potential-segv-.patch
new file mode 100644
index 0000000..c1b9939
--- /dev/null
+++ b/0001-src-extra.i-tests-test_annots.py-fix-potential-segv-.patch
@@ -0,0 +1,89 @@
+From 157122f3146bdc8dcbe0328d097bf081429f0441 Mon Sep 17 00:00:00 2001
+Message-ID: <157122f3146bdc8dcbe0328d097bf081429f0441.1793810565.git.mjg@fedoraproject.org>
+From: Julian Smith <julian.smith@artifex.com>
+Date: Mon, 7 Sep 2026 17:13:40 +0100
+Subject: [PATCH] src/extra.i tests/test_annots.py: fix potential segv/remote
+ code execution in JM_set_annot_callout_line().
+
+Fixes #5112.
+
+Also fixed similar problem in set_pixel() and ll_JM_color_count() if pixmap->n
+is out of range.
+
+(cherry picked from commit d4298ead84ceeae1c9065c81cd9a275a1b092f5e)
+---
+ src/extra.i | 15 +++++++++++----
+ tests/test_annots.py | 18 ++++++++++++++++++
+ 2 files changed, 29 insertions(+), 4 deletions(-)
+
+diff --git a/src/extra.i b/src/extra.i
+index bf04ebb8..8f0a85c3 100644
+--- a/src/extra.i
++++ b/src/extra.i
+@@ -788,6 +788,10 @@ static void JM_set_annot_callout_line(mupdf::PdfAnnot& annot, PyObject *callout,
+ {
+ fz_point points[3];
+ mupdf::FzPoint p;
++ if (count > sizeof(points)/sizeof(points[0]))
++ {
++ throw std::runtime_error(MSG_BAD_ARG_POINTS);
++ }
+ for (int i = 0; i < count; i++)
+ {
+ p = JM_point_from_py(PyTuple_GetItem(callout, (Py_ssize_t) i));
+@@ -3973,11 +3977,11 @@ PyObject *set_pixel(fz_pixmap* pm, int x, int y, PyObject *color)
+ throw std::range_error( MSG_PIXEL_OUTSIDE);
+ }
+ int n = pm->n;
+- if (!PySequence_Check(color) || PySequence_Size(color) != n) {
+- throw std::range_error(MSG_BAD_COLOR_SEQ);
+- }
+ int i, j;
+ unsigned char c[5];
++ if (!PySequence_Check(color) || PySequence_Size(color) != n || n > sizeof(c)) {
++ throw std::range_error(MSG_BAD_COLOR_SEQ);
++ }
+ for (j = 0; j < n; j++) {
+ if (JM_INT_ITEM(color, j, &i) == 1) {
+ throw std::range_error(MSG_BAD_COLOR_SEQ);
+@@ -4347,7 +4351,10 @@ PyObject* ll_JM_color_count(fz_pixmap *pm, PyObject *clip)
+ unsigned char* s = pm->samples + stride * (irect.y0 - pm->y) + n * (irect.x0 - pm->x);
+ // Cache previous pixel.
+ char oldpix[10];
+- assert(n <= sizeof(oldpix));
++ if (n > sizeof(oldpix))
++ {
++ throw std::range_error(MSG_PIXEL_OUTSIDE);
++ }
+ memcpy(oldpix, s, n);
+ long cnt = 0;
+ for (size_t i = 0; i < height; i++)
+diff --git a/tests/test_annots.py b/tests/test_annots.py
+index a0be8225..b7a8861c 100644
+--- a/tests/test_annots.py
++++ b/tests/test_annots.py
+@@ -793,3 +793,21 @@ def test_4936():
+ drawings = page.get_drawings()
+ print(f'{len(drawings)=}')
+ assert len(drawings) == 0
++
++
++def test_5112():
++ print()
++ with pymupdf.open() as document:
++ page = document.new_page()
++ rect = pymupdf.Rect(50, 50, 200, 150)
++ callout = [(10, 10)] * 100
++ try:
++ print(f'test_5112(): calling page.add_freetext_annot().', flush=1)
++ e = page.add_freetext_annot(rect, "test", callout=callout)
++ except Exception as e:
++ print(f'Received exception: {e}')
++ assert isinstance(e, RuntimeError)
++ assert str(e) == 'bad seq of points'
++ else:
++ assert 0, f'Expected exception from page.add_freetext_annot().'
++
+--
+2.56.0.465.g025799887a
+
diff --git a/python-PyMuPDF.spec b/python-PyMuPDF.spec
index f640671..48171af 100644
--- a/python-PyMuPDF.spec
+++ b/python-PyMuPDF.spec
@@ -28,6 +28,8 @@ Patch: 0001-remove-usage-of-typing.ByteString.patch
# for compatibility with SWIG 4.5.0
# https://github.com/pymupdf/PyMuPDF/pull/5072
Patch: 0001-Replace-removed-Python-2-C-API-macros-for-SWIG-4.5.0.patch
+# Upstream patch:
+Patch: 0001-src-extra.i-tests-test_annots.py-fix-potential-segv-.patch
# test dependencies not picked up by generator
BuildRequires: python3dist(pillow)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-04 20:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 20:11 [rpms/python-PyMuPDF] rawhide: fix CVE-2026-120752 (rhbz#2567075) (rhbz#2567076) Michael J Gruber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox