Skip to content

Exception when rendering corrupt pages with no height #14

@Jonowa

Description

@Jonowa

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions