-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Piximap program crash #3848
Labels
Comments
Please do provide reproducing file and code. |
|
This script works: import pymupdf
doc = pymupdf.open("case.pdf")
page = doc[1]
paths = page.get_drawings()
for i, p in enumerate(paths):
rect = p["rect"] # best check for emptiness already here!
text = page.get_textbox(rect)
if text:
pix = page.get_pixmap(clip=rect)
if pymupdf.IRect(pix.irect).is_empty:
print(i, "pixmap has empty area - skipping")
continue
print("path", i, pix.color_topusage()) So the reason for the crash is a pixmap that covers no area, and the Otherwise please take note of the following comments:
|
julian-smith-artifex-com
added a commit
that referenced
this issue
Oct 22, 2024
…ixmap. Pixmap.color_count(): don't raise exception if JM_color_count() returns empty dict. _read_samples(): return empty list if pixmap has no samples - avoids segv from fz_samples_get(). Addresses #3848.
julian-smith-artifex-com
added
the
fix developed
release schedule to be determined
label
Oct 22, 2024
julian-smith-artifex-com
added a commit
that referenced
this issue
Oct 22, 2024
…ixmap. Pixmap.color_count(): don't raise exception if JM_color_count() returns empty dict. _read_samples(): return empty list if pixmap has no samples - avoids segv from fz_samples_get(). Addresses #3848.
Fixed in 1.24.13. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Description of the bug
What is happening is that when I read from the PDF, I use the rectangle information to collect color data. Recently, however, I encountered an issue with one of the PDF collections: while collecting the color information, the program crashes unexpectedly without any error messages. I traced the problem to the color_topusage function. Specifically, the error appears to originate from the call to this function, where the issue seems to be related to color_count -> JM_color_count -> oldpix = read_sample(pm, s, n).
How to reproduce the bug
I traced the problem to the color_topusage function. Specifically, the error appears to originate from the call to this function, where the issue seems to be related to color_count -> JM_color_count -> oldpix = read_sample(pm, s, n).
PyMuPDF version
1.24.10
Operating system
Windows
Python version
3.12
The text was updated successfully, but these errors were encountered: