public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-PyMuPDF] f43: fix CVE-2026-120752 (rhbz#2567074)
@ 2026-11-05 6:57 Michael J Gruber
0 siblings, 0 replies; only message in thread
From: Michael J Gruber @ 2026-11-05 6:57 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-PyMuPDF
Branch : f43
Commit : 4ecab87d846ad4b5c8f3b4bc9b01c77ec058d8ec
Author : Michael J Gruber <mjg@fedoraproject.org>
Date : 2026-11-04T23:00:30+01:00
Stats : +90/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/python-PyMuPDF/c/4ecab87d846ad4b5c8f3b4bc9b01c77ec058d8ec?branch=f43
Log:
fix CVE-2026-120752 (rhbz#2567074)
---
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..8f948ba
--- /dev/null
+++ b/0001-src-extra.i-tests-test_annots.py-fix-potential-segv-.patch
@@ -0,0 +1,89 @@
+From e727cd76a3fd0522ab9629621eca54f8d865e411 Mon Sep 17 00:00:00 2001
+Message-ID: <e727cd76a3fd0522ab9629621eca54f8d865e411.1793829594.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 d2d96811..9fb2ceac 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));
+@@ -3956,11 +3960,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);
+@@ -4330,7 +4334,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 12296829..7cbfd516 100644
+--- a/tests/test_annots.py
++++ b/tests/test_annots.py
+@@ -718,3 +718,21 @@ def test_4755():
+ document.save(path_out)
+ print(f' {path=}.')
+ print(f'{path_out=}.')
++
++
++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 d3ebfe6..30b1eb5 100644
--- a/python-PyMuPDF.spec
+++ b/python-PyMuPDF.spec
@@ -24,6 +24,7 @@ Patch: 0001-adjust-tests-to-tesseract-5.5.1.patch
Patch: 0001-tests-conftest-do-not-call-pip.patch
# Upstream patches from main branch:
Patch: 0001-src-__init__.py-fix-incorrect-generation-of-PDF-cont.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-05 6:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 6:57 [rpms/python-PyMuPDF] f43: fix CVE-2026-120752 (rhbz#2567074) 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