Skip to content

cfFilterGhostscript fails with rangecheck when PPD sets cupsCompression=-1 #218

Description

@jslocomotor

Environment

  • OS: Arch Linux
  • CUPS: 2.4.19-1
  • libcups: 2.4.19-1
  • cups-filters: 2.0.1-2
  • libcupsfilters: 2.2.1-2
  • libppd: 2.1.1-2
  • Ghostscript: 10.07.1-1
  • Printer: Zebra ZD621
  • Driver: Zebra ZPL Label Printer (rastertolabel)
  • Connection: socket://<printer-ip>:9100

Problem

Printing PDF files to a Zebra ZD621 suddenly fails in the CUPS universal filter.

The relevant errors are:

cfFilterGhostscript: Error setting cupsCompression ...
cfFilterGhostscript: Unrecoverable error: rangecheck in .putdeviceprops
cfFilterGhostscript: Ghostscript stopped with status 255
universal filter failed.

The Zebra PPD uses cupsCompression for the printer darkness setting.

The default "Printer Default" darkness value is defined as:

*DefaultDarkness: -1
*Darkness -1/Printer Default: "<</cupsCompression -1>>setpagedevice"

When this default is used, cfFilterGhostscript passes the following argument to Ghostscript:

-dcupsCompression=4294967295

This appears to be the PPD value -1 being converted to an unsigned 32-bit value (UINT32_MAX).

Ghostscript then fails with:

Error setting cupsCompression ...
Unrecoverable error: rangecheck in .putdeviceprops

Relevant CUPS log

The PDF is successfully passed through pdftopdf, but Ghostscript fails while generating CUPS Raster:

D [29/Aug/2026:14:46:42 +0200] [Job 65] cfFilterUniversal: Converting from application/pdf to application/vnd.cups-raster
D [29/Aug/2026:14:46:42 +0200] [Job 65] cfFilterUniversal: Adding pdftopdf to chain
D [29/Aug/2026:14:46:42 +0200] [Job 65] cfFilterUniversal: Adding ghostscript to chain
D [29/Aug/2026:14:46:42 +0200] [Job 65] cfFilterChain: Running filter: pdftopdf
D [29/Aug/2026:14:46:42 +0200] [Job 65] cfFilterChain: Running filter: ghostscript
D [29/Aug/2026:14:46:42 +0200] [Job 65] cfFilterChain: pdftopdf completed with status 0.
D [29/Aug/2026:14:46:42 +0200] [Job 65] cfFilterGhostscript: Input format: PDF
D [29/Aug/2026:14:46:42 +0200] [Job 65] cfFilterGhostscript: Ghostscript using Any-Part-of-Pixel method to fill paths.

The generated Ghostscript command line contains:

gs -dQUIET -dSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE -dNOMEDIAATTRS -dUsePDFX3Profile -sstdout=%stderr -sOutputFile=%stdout -sDEVICE=cups -dAdvanceDistance=1000 -r203x203 -dDEVICEWIDTHPOINTS=288 -dDEVICEHEIGHTPOINTS=432 -dcupsBitsPerColor=1 -dcupsColorOrder=0 -dcupsColorSpace=3 -dcupsCompression=4294967295 -dcupsRowStep=200 -scupsRenderingIntent=auto -scupsPageSizeName=4x6.Borderless -dcupsManualCopies -I/usr/share/cups/fonts -c '<</.HWMargins[0.000000 0.000000 0.000000 0.000000] /Margins[0 0]>>setpagedevice' -f -_

Immediately afterwards:

cfFilterGhostscript: Error setting cupsCompression ...
cfFilterGhostscript: Ghostscript stopped with status 255
cfFilterGhostscript: Unrecoverable error: rangecheck in .putdeviceprops
cfFilterChain: ghostscript stopped with status 1
universal filter failed.

PPD configuration

The relevant section of the Zebra PPD is:

*OpenUI *Darkness/Darkness: PickOne
*OrderDependency: 20 AnySetup *Darkness
*DefaultDarkness: -1
*Darkness -1/Printer Default: "<</cupsCompression -1>>setpagedevice"
*Darkness 1/1: "<</cupsCompression 4>>setpagedevice"
*Darkness 2/2: "<</cupsCompression 7>>setpagedevice"
*Darkness 3/3: "<</cupsCompression 10>>setpagedevice"
*Darkness 4/4: "<</cupsCompression 14>>setpagedevice"
*Darkness 5/5: "<</cupsCompression 17>>setpagedevice"
*Darkness 6/6: "<</cupsCompression 20>>setpagedevice"
*Darkness 7/7: "<</cupsCompression 24>>setpagedevice"
*Darkness 8/8: "<</cupsCompression 27>>setpagedevice"
*Darkness 9/9: "<</cupsCompression 30>>setpagedevice"
*Darkness 10/10: "<</cupsCompression 34>>setpagedevice"
*Darkness 11/11: "<</cupsCompression 37>>setpagedevice"
*Darkness 12/12: "<</cupsCompression 40>>setpagedevice"
*Darkness 13/13: "<</cupsCompression 44>>setpagedevice"
*Darkness 14/14: "<</cupsCompression 47>>setpagedevice"
*Darkness 15/15: "<</cupsCompression 50>>setpagedevice"

The available darkness settings reported by CUPS are:

$ lpoptions -p Zebra_ZD621 -l | grep -i Darkness
Darkness/Darkness: *-1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

Workaround

Explicitly selecting a valid darkness value fixes the problem.

For example:

$ lpoptions -p Zebra_ZD621 -o Darkness=15

This was first verified by printing a PDF directly:

$ lp -d Zebra_ZD621 label.pdf
request id is Zebra_ZD621-68 (1 file(s))

The PDF printed successfully.

Setting the value as the system-wide CUPS printer default also fixes printing from applications such as Firefox:

$ sudo lpadmin -p Zebra_ZD621 -o Darkness=15

Afterwards CUPS reports:

$ lpoptions -p Zebra_ZD621 -l | grep Darkness
Darkness/Darkness: -1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 *15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

and the PPD contains:

*DefaultDarkness: 15

For Darkness=15, the PPD specifies:

*Darkness 15/15: "<</cupsCompression 50>>setpagedevice"

Printing PDF shipping labels from Firefox works normally after this change.

Expected behavior

A PPD setting of:

cupsCompression=-1

should not result in an invalid Ghostscript invocation with:

-dcupsCompression=4294967295

which causes Ghostscript to abort.

Ideally, the special/default value -1 should either:

  • retain its intended semantics,
  • be handled as a signed value,
  • be ignored when appropriate, or
  • fail gracefully instead of causing the complete print job to fail.

Filter chain

The affected PDF printing path is:

application/pdf
    |
    v
pdftopdf
    |
    v
ghostscript
    |
    v
application/vnd.cups-raster
    |
    v
rastertolabel
    |
    v
Zebra ZD621

The failure occurs in the Ghostscript stage when cupsCompression=4294967295 is applied.

Summary

The observed failure is:

PPD:
cupsCompression = -1
        |
        v
cfFilterGhostscript:
-dcupsCompression=4294967295
        |
        v
Ghostscript:
rangecheck in .putdeviceprops
        |
        v
universal filter failed

Using an explicit valid Darkness value avoids the problem.

The exact component responsible for converting or propagating -1 as 4294967295 is not clear, so this report does not assume whether the fix belongs in libcupsfilters, libppd, Ghostscript, or elsewhere in the printing stack.

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