Skip to content

PdfPig 0.1.11 breaks image decoding with "Decoded stream size exceeds estimated maximum" error #1125

@ilCosmico

Description

@ilCosmico

Issue Summary

After updating the following packages:

  • PdfPig from 0.1.10 to 0.1.11
  • PdfPig.Filters.Dct.JpegLibrary from 0.1.10.2 to 0.1.11

I'm getting a PdfDocumentFormatException when trying to read a specific PDF file.

Exception


UglyToad.PdfPig.Core.PdfDocumentFormatException: Decoded stream size exceeds the estimated maximum size.
Current decoded stream length: 2266737, 1 filters applied out of 2.

This happens during image extraction for an XObject image.
Rolling back to the previous versions resolves the issue.

Additional Notes

  • The exception is thrown while processing an image with width 1379 px and height 236.64 px.
  • The error seems to be related to the new version of PdfPig.Filters.Dct.JpegLibrary.

Attachments

  • A screenshot showing the exact code and exception:
Image
  • The PDF file used to reproduce the issue
    testCase.pdf
  • A minimal reproducible example in a ZIP file: this contains a small Visual Studio project that triggers the error directly
    PdfPigTest.7z.txt (Please rename the attached file from .txt back to .7z before extracting.)

Steps to Reproduce

  1. Open and run the attached sample project
  2. The exception is thrown during image extraction using TryGetPng() or GetImageBytes()

Expected Behavior

The image should be decoded without throwing an exception, as it was in version 0.1.10.

Please let me know if you need further details or if I can help further in some way.

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