ghostscript: serialize raster integer parameters as signed - #225
Open
victortrac wants to merge 1 commit into
Open
ghostscript: serialize raster integer parameters as signed#225victortrac wants to merge 1 commit into
victortrac wants to merge 1 commit into
Conversation
Signed-off-by: Victor Trac <victor@cloudkite.io>
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.
Fixes #218.
Related to #222.
Problem
Commit b558b36 changed several Ghostscript CUPS raster parameters from
signed (
%d) to unsigned (%u) formatting.Some fields in
cups_page_header_tare unsigned storage locations butlegitimately contain the two's-complement representation of signed values.
For example, label-printer PPDs use:
With libcupsfilters 2.2.1 this is emitted as:
Ghostscript reads these device properties using its signed
param_read_int()interface, rejects the value, and terminates with:The same signedness problem affects
cupsInteger[], as demonstrated byissue #222.
Fix
Serialize CUPS raster integer fields using
%dwith an explicit(int)conversion. This preserves signed values while avoiding the original
printf argument-type mismatch.
Reproduction
Environment:
rastertolabelPPDUsing the PPD default
Darkness=-1:-dcupsCompression=4294967295-dcupsCompression=-1The test invokes the
universalfilter directly with the same PPD andinput PDF, changing only the loaded libcupsfilters library.
Testing
make check: 9 passed, 0 failedpatched-2.2.1.log
unpatched-2.2.1.log