title: cups rejects printing pdf files with 'filter error' probalbly due to a too-long-title
body: <p>My system is Debian 3.16.7. Today I rendered a printing job (a paper names <em>Distributed Representations of Words and Phrases and their Compositionality</em>) using cups to my Kyocera fs-1041 printer. However the printer reject to print with an error message of 'Filter failed' at the browser control panel of cups. </p>
  
  <p>Inside my /var/cups/error_log it says:</p>
  
  <pre><code>    E [18/Sep/2016:12:36:27 +0200] [Job 225] Job stopped due to filter errors; please consult the error_log file for details.
      D [18/Sep/2016:12:36:27 +0200] [Job 225] The following messages were recorded from 12:36:21 PM to 12:36:27 PM
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Adding start banner page "none".
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Adding end banner page "none".
      D [18/Sep/2016:12:36:27 +0200] [Job 225] File of type application/pdf queued by "root".
      D [18/Sep/2016:12:36:27 +0200] [Job 225] hold_until=0
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Queued on "Kyocera_FS-1041" by "root".
      D [18/Sep/2016:12:36:27 +0200] [Job 225] time-at-processing=1474194981
      D [18/Sep/2016:12:36:27 +0200] [Job 225] 3 filters for job:
      D [18/Sep/2016:12:36:27 +0200] [Job 225] pdftopdf (application/pdf to application/vnd.cups-pdf, cost 66)
      D [18/Sep/2016:12:36:27 +0200] [Job 225] gstoraster (application/vnd.cups-pdf to application/vnd.cups-raster, cost 99)
      D [18/Sep/2016:12:36:27 +0200] [Job 225] /usr/lib/cups/filter/rastertokpsl (application/vnd.cups-raster to printer/Kyocera_FS-1041, cost 0)
      D [18/Sep/2016:12:36:27 +0200] [Job 225] job-sheets=none,none
      D [18/Sep/2016:12:36:27 +0200] [Job 225] argv[0]="Kyocera_FS-1041"
      D [18/Sep/2016:12:36:27 +0200] [Job 225] argv[1]="225"
      D [18/Sep/2016:12:36:27 +0200] [Job 225] argv[2]="root"
      D [18/Sep/2016:12:36:27 +0200] [Job 225] argv[3]="Distributed Representations of Words and Phrases and their Compositionality - 5021-distributed-representations-of-words-and-phrases-and-their-compositionality.pdf"
      D [18/Sep/2016:12:36:27 +0200] [Job 225] argv[4]="1"
      D [18/Sep/2016:12:36:27 +0200] [Job 225] argv[5]="CaBrightness=0 PageSize=Letter MediaType=PrnDef EngineSpeed=Off CaContrast=0 number-up=1 job-uuid=urn:uuid:a19e56db-80b7-307d-4359-b8a1c32c90f5 job-originating-host-name=localhost time-at-creation=1474194981 time-at-processing=1474194981"
      D [18/Sep/2016:12:36:27 +0200] [Job 225] argv[6]="/var/spool/cups/d00225-001"
      ...
      &lt;!-envps&gt;
      ...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] envp[29]="FINAL_CONTENT_TYPE=application/vnd.cups-raster"
      D [18/Sep/2016:12:36:27 +0200] [Job 225] envp[30]="AUTH_I****"
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Started filter /usr/lib/cups/filter/pdftopdf (PID 4664)
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Started filter /usr/lib/cups/filter/gstoraster (PID 4665)
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Started filter /usr/lib/cups/filter/rastertokpsl (PID 4666)
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Started backend /usr/lib/cups/backend/usb (PID 4667)
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Loading USB quirks from "/usr/share/cups/usb".
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Loaded 113 quirks.
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Printing on printer with URI: usb://Kyocera/FS-1041?serial=NZF2X06371
      D [18/Sep/2016:12:36:27 +0200] [Job 225] *** buffer overflow detected ***: Kyocera_FS-1041 terminated
      D [18/Sep/2016:12:36:27 +0200] [Job 225] ======= Backtrace: =========
      D [18/Sep/2016:12:36:27 +0200] [Job 225] /lib/x86_64-linux-gnu/libc.so.6(+0x731af)[0x7f525aaf11af]
      D [18/Sep/2016:12:36:27 +0200] [Job 225] /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7f525ab76cf7]
      D [18/Sep/2016:12:36:27 +0200] [Job 225] /lib/x86_64-linux-gnu/libc.so.6(+0xf6f10)[0x7f525ab74f10]
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Kyocera_FS-1041[0x406c87]
      D [18/Sep/2016:12:36:27 +0200] [Job 225] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f525aa9fb45]
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Kyocera_FS-1041[0x40799d]
      D [18/Sep/2016:12:36:27 +0200] [Job 225] ======= Memory map: ========
      D [18/Sep/2016:12:36:27 +0200] [Job 225] 00400000-00430000 r-xp 00000000 08:04 3541254                            /usr/lib/cups/filter/rastertokpsl
      ...
      &lt;!-Memory map-&gt;
      ...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
      D [18/Sep/2016:12:36:27 +0200] [Job 225] PID 4666 (/usr/lib/cups/filter/rastertokpsl) crashed on signal 6.
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Hint: Try setting the LogLevel to "debug" to find out more.
      D [18/Sep/2016:12:36:27 +0200] [Job 225] libusb_get_device_list=8
      D [18/Sep/2016:12:36:27 +0200] [Job 225] STATE: +connecting-to-device
      D [18/Sep/2016:12:36:27 +0200] [Job 225] STATE: -connecting-to-device
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Printer found with device ID: MFG:Kyocera;MDL:FS-1041;CLS:PRINTER;SN:NZF2X06371;CID:KY_KPSL_MonoPersonal; Device URI: usb://Kyocera/FS-1041?serial=NZF2X06371
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Device protocol: 2
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Sending data to printer.
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Sent 0 bytes...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] PID 4664 (/usr/lib/cups/filter/pdftopdf) exited with no errors.
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Color Manager: Calibration Mode/Off
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Calling FindDeviceById(cups-Kyocera_FS-1041)
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Found device /org/freedesktop/ColorManager/devices/cups_Kyocera_FS_1041
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Calling org.freedesktop.ColorManager.Device.Get(ProfilingInhibitors)
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Calling FindDeviceById(cups-Kyocera_FS-1041)
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Found device /org/freedesktop/ColorManager/devices/cups_Kyocera_FS_1041
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Calling GetProfileForQualifiers(Gray.PrnDef.600dpi...)
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Found profile /org/freedesktop/ColorManager/profiles/Kyocera_FS_1041_Gray__
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Calling org.freedesktop.ColorManager.Profile.Get(Filename)
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Use profile filename: ''
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Color Manager: ICC Profile: 
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Ghostscript command line: /usr/bin/gs -dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE -sDEVICE=cups -sstdout=%stderr -sOutputFile=%stdout -r600x600 -dDEVICEWIDTHPOINTS=612 -dDEVICEHEIGHTPOINTS=792 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=3 -dcupsCompression=1 -scupsPageSizeName=Letter -I/usr/share/cups/fonts -c '&lt;&lt;/.HWMargins[12.000000 8.000000 12.000000 16.000000] /Margins[0 0]&gt;&gt;setpagedevice' -f -_
      D [18/Sep/2016:12:36:27 +0200] [Job 225] envp[0]="CUPS_CACHEDIR=/var/cache/cups"
      ...
      &lt;!-envps-&gt;
      ...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] envp[30]="AUTH_INFO_REQUIRED=none"
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Start rendering...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Processing page 1...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Processing page 2...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Waiting for read thread to exit...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] PID 4667 (/usr/lib/cups/backend/usb) exited with no errors.
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Processing page 3...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Processing page 4...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Processing page 5...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Processing page 6...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Processing page 7...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Processing page 8...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Processing page 9...
      D [18/Sep/2016:12:36:27 +0200] [Job 225] Rendering completed
      D [18/Sep/2016:12:36:27 +0200] [Job 225] PID 4665 (/usr/lib/cups/filter/gstoraster) exited with no errors.
      D [18/Sep/2016:12:36:27 +0200] [Job 225] End of messages
  </code></pre>
  
  <p>Have searched several issues and questions like <a href="https://ubuntuforums.org/showthread.php?t=2234800" rel="nofollow">this</a> or <a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=660420" rel="nofollow">this</a> and so on, i could still not find a way to get rid of this problem. </p>
  
  <p>Strangely, right now the cups' test page or doc files created by LibreOffice etc. are still able to be printed.</p>
  
  <p>So i guess it may be caused by the pdf file itself and start to hack in the formated file and finally realized that a too-long <code>/Title</code> field will cause this problem. After altering this field from "Distributed Representations of Words and Phrases and their Compositionality" to just "test", it really works!!</p>
  
  <p>But it's still unknown why this long <code>/Title</code> field will cause a filter error, could anyone please suggest an answer or post me a link about how do filters behave with a pdf file?</p>