-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
PdfReadError: Too many lookup values while extracting image #2889
Labels
is-robustness-issue
From a users perspective, this is about robustness
workflow-images
From a users perspective, image handling is the affected feature/workflow
Comments
Thanks for your report. Your PDF file seems to contain some invalid color lookup tables, especially on page 13. The first broken LUT is too big, the following LUTs are too small. The following code for lines 212 to 224 seems to fix it: if len(lookup) != expected_count:
if len(lookup) < expected_count:
logger_warning(
f"Not enough lookup values: Expected {expected_count}, got {len(lookup)}.",
__name__
)
lookup += bytes([0] * (expected_count - len(lookup)))
elif not check_if_whitespace_only(lookup[expected_count:]):
logger_warning(
f"Too many lookup values: Expected {expected_count}, got {len(lookup)}.",
__name__
)
lookup = lookup[:expected_count] This basically adds a right padding with null bytes if there are not enough values and always cuts all entries which are out of bounds - and emits warnings instead of hard errors. |
stefan6419846
added
workflow-images
From a users perspective, image handling is the affected feature/workflow
is-robustness-issue
From a users perspective, this is about robustness
labels
Oct 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
is-robustness-issue
From a users perspective, this is about robustness
workflow-images
From a users perspective, image handling is the affected feature/workflow
Environment
Which environment were you using when you encountered the problem?
Code + PDF
This is a minimal, complete example that shows the issue:
New York State 100AnnvBook140701final10.pdf
Traceback
The text was updated successfully, but these errors were encountered: