pclmtoraster.c: Fix getting MediaBox from input - #208
Merged
tillkamppeter merged 2 commits intoAug 11, 2026
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
commit:
Fixed several issues in PCLm processing
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).
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.
buffer was array of pointers to char instead of array of chars -
saves memory
making code straight, adding return value checks, grouping local vars
at the beginning
Assisted-By: Claude Code