Skip to content

pclmtoraster.c: Fix getting MediaBox from input - #208

Merged
tillkamppeter merged 2 commits into
OpenPrinting:masterfrom
zdohnal:pclmtoraster-mediabox-fix
Aug 11, 2026
Merged

pclmtoraster.c: Fix getting MediaBox from input#208
tillkamppeter merged 2 commits into
OpenPrinting:masterfrom
zdohnal:pclmtoraster-mediabox-fix

Conversation

@zdohnal

@zdohnal zdohnal commented Aug 11, 2026

Copy link
Copy Markdown
Member
  1. commit:

The affected function had logic inverted - error handling happened when MediaBox was found - which caused no output was generated.

The PR fixes it and adds logic to get MediaBox from parent object, because per PDF specification MediaBox can be inherited from parent.

  1. commit:

    Fixed several issues in PCLm processing

    1. The input PCLm might not have /Type set for images, because it is
      optional key, filter has to look for subtype Image (fixed typo image ->
      Image).

    2. PDFIO read stream function can return -1, so it has to be saved in
      ssize_t to get correct interpretation - otherwise the filter aborts on
      alloc of large number.

    3. buffer was array of pointers to char instead of array of chars -
      saves memory

    4. making code straight, adding return value checks, grouping local vars
      at the beginning

Assisted-By: Claude Code

The affected function had logic inverted - error handling happened when
MediaBox was found - which caused no output was generated.

The PR fixes it and adds logic to get MediaBox from parent object,
because per PDF specification MediaBox can be inherited from parent.

Assisted-By: Claude Code
Fixed several issues in PCLm processing

1. The input PCLm might not have /Type set for images, because it is
optional key, filter has to look for subtype Image (fixed typo image ->
Image).

2. PDFIO read stream function can return -1, so it has to be saved in
ssize_t to get correct interpretation - otherwise the filter aborts on
alloc of large number.

3. buffer was array of pointers to char instead of array of chars -
saves memory

4. making code straight, adding return value checks, grouping local vars
at the beginning

Assisted-By: Claude Code by Anthropic
@zdohnal
zdohnal requested a review from tillkamppeter August 11, 2026 15:58
@tillkamppeter
tillkamppeter merged commit 76510c1 into OpenPrinting:master Aug 11, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants