Skip to content
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

BUG: Truncate mediabox and cropbox values with > 4 points. #3001

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sjudd
Copy link

@sjudd sjudd commented Dec 13, 2024

Closes #2991

I confirmed that this fixes the read issue with the PDF where I experienced the original issue. I've been relatively conservative about allowing bad rectangle values and limited this to just mediabox/cropbox. If we felt good about generically handling rectangles with too many points, it would be easy to do so in RectangleObject instead.

I'm not certain the test I wrote is particularly good, it's just hacking the mediabox/cropbox to the value I see in the exception. I'd love to upload the original PDF as an example, but it contains customer information. That said, I believe I can reproduce this bad file using pypdf (and pypdf is the source of the original bad file), so I'll follow up in the related issue if I can reproduce and fix the write side error.

@stefan6419846 stefan6419846 added the needs-discussion The PR/issue needs more discussion before we can continue label Dec 14, 2024
@stefan6419846
Copy link
Collaborator

Given the ongoing discussions in #2991, I am going to put this on hold for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-discussion The PR/issue needs more discussion before we can continue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assert fails when getting the mediabox property for certain PDFs
2 participants