-
Notifications
You must be signed in to change notification settings - Fork 638
Description
Please provide all mandatory information!
Describe the bug (mandatory)
If a redaction rectangle overlaps an image with a mask (= image with transparency) and page.apply_redactions(images=fitz.PDF_REDACT_IMAGE_PIXELS)
is used (the default), the interpreter crashes with segmentation fault. Verified under Linux and Windows.
To Reproduce (mandatory)
Execute with the attached reproducer PDF:
import fitz
doc=fitz.open("input.pdf")
page=doc[0]
page.apply_redactions()
Your configuration (mandatory)
In [2]: print(fitz.__doc__)
PyMuPDF 1.20.0: Python bindings for the MuPDF 1.20.1 library.
Version date: 2022-06-27 00:00:01.
Built for Python 3.9 on win32 (64-bit).
In [2]: print(fitz.__doc__)
PyMuPDF 1.20.0: Python bindings for the MuPDF 1.20.1 library.
Version date: 2022-06-27 00:00:01.
Built for Python 3.8 on linux (64-bit).
Additional context (optional)
This is also the case for other Python versions - tested up to Python 3.10.
It did work (although with bugs - see comment at the bottom of this) in v 1.19.x.
When recompiling under Windows (Linux yet to be confirmed), things will work again as before.
The error occurs in
which invokes this C-code:
Please note that for transparent images, the MuPDF code will produce a PNG image without transparency.
This is a known problem and does not otherwise interfere with this bug.
Using one of the other options for handling images with redactions continue to work fine.