Public bug reported: Ghostscript 10.06.0 pdfwrite can write passed-through JPEG (DCTDecode) images without their final EOI marker (FF D9): the last 2 bytes of the original JPEG are lost.
Impact: strict consumers reject the output. A Brother MFC-L8730CDW (firmware 1.20) aborted such a job with "Document format error". This breaks printing through CUPS: a PostScript job (e.g. from Okular, which prints PDFs via PostScript) is converted to PDF by Ghostscript and sent to the driverless IPP queue, and the printer rejects it. CUPS only logs "Unable to cancel print job." and marks the job completed. Putting the 2 missing bytes back into the output PDF, with no other change, made the printer accept it. Package: ghostscript 10.06.0~dfsg-3ubuntu1.2 (Ubuntu 26.04) Steps to reproduce (test.pdf attached; it embeds a 27794-byte JPEG that ends with FF D9): gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf test.pdf mutool show -be -o out.jpg out.pdf <object number of the DCTDecode image> tail -c2 out.jpg | xxd -p Expected: out.jpg identical to the embedded JPEG (27794 bytes, ends ffd9). Actual: out.jpg is 27792 bytes and ends 787f (no EOI marker). The same happens with PostScript input (pdftops test.pdf; gs ... test.ps). -dPassThroughJPEGImages=false avoids the problem. Not every JPEG triggers it; it depends on how the data falls in the decoder's final input buffer. Upstream: - Regression introduced by ghostpdl commit bcca894a7 (bug 708557, "don't write EOI when PassThrough is true"), first released in 10.06.0. - Fixed by ghostpdl commit eaada7d16 (bug 708956, "Fix flushing the final buffer of JPEG passthrough data"), released in 10.07.0: https://github.com/ArtifexSoftware/ghostpdl/commit/eaada7d16 - The fix touches base/sdctd.c and base/sjpegd.c. Both files are identical in 10.06.0 and the fix's parent commit, so the fix applies cleanly to the 26.04 package. Please consider backporting eaada7d16 to the ghostscript package in 26.04. ProblemType: Bug DistroRelease: Ubuntu 26.04 Package: ghostscript 10.06.0~dfsg-3ubuntu1.2 ProcVersionSignature: Ubuntu 7.0.0-42.42-generic 7.0.14 Uname: Linux 7.0.0-42-generic x86_64 ApportVersion: 2.34.1-0ubuntu0.1 Architecture: amd64 CasperMD5CheckResult: unknown CurrentDesktop: KDE Date: Fri Oct 30 23:45:13 2026 InstallationDate: Installed on 2023-12-01 (1064 days ago) InstallationMedia: Kubuntu 22.04.3 LTS "Jammy Jellyfish" - Release amd64 (20230807.1) SourcePackage: ghostscript UpgradeStatus: Upgraded to resolute on 2026-09-23 (38 days ago) ** Affects: ghostscript (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug resolute wayland-session ** Attachment added: "test.pdf" https://bugs.launchpad.net/bugs/2172643/+attachment/6013886/+files/test.pdf -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2172643 Title: pdfwrite JPEG passthrough drops EOI marker (regression in 10.06.0, fixed upstream in 10.07.0) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/ghostscript/+bug/2172643/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
