public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Michael J Gruber <mjg@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/python-PyMuPDF] f43: fix CVE-2026-120752 (rhbz#2567074)
Date: Thu, 05 Nov 2026 06:57:02 GMT [thread overview]
Message-ID: <179386182210.1.18340578037797140646.rpms-python-PyMuPDF-4ecab87d846a@fedoraproject.org> (raw)
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)
reply other threads:[~2026-11-05 6:57 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=179386182210.1.18340578037797140646.rpms-python-PyMuPDF-4ecab87d846a@fedoraproject.org \
--to=mjg@fedoraproject.org \
--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