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

Exception when rendering corrupt pages with no height #14

Open
Jonowa opened this issue Feb 1, 2024 · 0 comments
Open

Exception when rendering corrupt pages with no height #14

Jonowa opened this issue Feb 1, 2024 · 0 comments

Comments

@Jonowa
Copy link

Jonowa commented Feb 1, 2024

I've tried to open a PDF document containing a corrupt page with a height of 0. The image renderer throws an exception caused by the invalid value of height.
My solution is to set a minimum value to both parameters width and height using Math.Max().

File: PdfDocument.cs
Line: 334

var bitmap = new Bitmap(Math.Max(1, width), Math.Max(1, height), PixelFormat.Format32bppArgb);
@Jonowa Jonowa changed the title Exception when rendering corrupt pages with height=0 Exception when rendering corrupt pages with no height Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant