Bug 228808 - Premature EOF in image causes bad JPEG stream in PDF
Premature EOF in image causes bad JPEG stream in PDF
Status: NOTIFIED LATER
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer
master
All All
: P2 normal
Assigned To: Jack Moffitt
Bug traffic
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2001-01-14 22:11 PST by Alex Cherepanov
Modified: 2014-02-17 04:37 PST (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Cherepanov 2001-01-14 22:11:54 PST
Originally reported by: alexcher@users.sourceforge.net
tiff2ps utility from libtiff distribution creates PS files that often have premature EOF in the last band of data. GS initializes JPEG compressor to the full band width (=height). When EOF is encountered GS updates the height in PDF obj but JPEG stream is already written.

GS should buffer the whole image and start compression only after the whole image is retrieved. This will also help to choose the encoding filter based on contents of the image as Distiller does.

The file with premature EOF follows. 

%!
100 100 translate

/DeviceGray setcolorspace

<<
  /ImageType 1
  /Width 437
  /Height 64
  /ImageMatrix [ 1 0 0 -1 0 0 ]
  /BitsPerComponent 8
  /Decode [0 1]
  /DataSource currentfile /ASCII85Decode filter /LZWDecode filter
>> image

J1r)3#UC/p#D>EP:q1$o*=mro@So+\<\4[Z5N$O+jE;Gl5QE%ULs0a,-]uIq;&KcL;(n;1Al
C^c@PnGl9&Po$,jIHRPKKaX=B'm3'p(cH1HH5U74+JQC/m<k8r5]`:b+?cj_?qQQdt$d[KVg
rJ>HEuP1k#hX)GLQDG^3E(3<Z_:@"$hb]:NJ]"r3KBhbU=Itp[3(Hc:g*AkR90(Z09;^Zb#h
Q,=WQ?+pLbee?44H5[:#,>>/3%Qtk9h3cBkk^i5NnFu_A+s3@jmm<pQ0#2S4RR!A5ibJH4FR
f"7CU'Ni>W5:&sq4XFun37esj/'m.b8-$r&s5kOa(F*A2!6Msn;iGaXS(F-kAHBg&)JDi7rS
40GWss1g;rCqZO%bLHd4N,o't_@CYE$,2;Oh$ZQ/A.YBJDL9,!Y`T$&m_g]A55[c_/'S:;O_
Uj#^/'D-qnk,3,-4891fE3cEBHel2%g$V"%UcRK,qOC>[8YtM[S1^\P\ln$HDVKAGO=3*'42
>;B,QVbHhUO/jSWb'dh0=8h.Ep%-p8>4t>?].o$_Q&CI8t/-sn9:8;AS4:gc^&A)sLa!FGZ9
ba'eZs7`*;6*An4=O5u*D=dYeJ1\,ZJ?f2du>(o9N70l2+5qB[8-WtDp/kle?t6<<R!Bpf2#
=fFXjk$<UFF(<>F%G8Co[S;-6oN96cE(Q>N1*g(o[EC"ek.-Y?PJc*_ECNMW`B=Vb#U`deil
c#_\M9tlG=[nY\&g36fJEScY$.sp.ic1QMBQgO`oU0%<tJ`)nFqN'DjXqcZLPf;g?iY[\%-/
nWj/W8WtDC^\+R-m)(@sIuAOlVQTH'78,:0!D;=`.N'AXS!YRGO?lBq+9#->f:9RI$E6kLpE
!o]R27NMEbI/s3!pMN3t!l5GOYK^)aDXG`paL:+/LRdRkmll-GRZ0[r4_1QSD:=Zc>Rr7&km
Mh2J\aGrim=1cO~>

showpage
%%EOF
Comment 1 Ray Johnston 2001-03-21 10:11:57 PST
Comment originally by rayjj@users.sourceforge.net
Logged In: YES 
user_id=11206

We acknowledge that this is a valid issue, but we do not have
resources available to address this at this time.

This problem report has been moved to doc/Issues.htm where it
may remain open for some time. Relevant comments are
captured there along with the ID# of this report.

By moving this issue to the widely distributed Ghostscript
documentation, we wish to make this issue well known and
solicit help in improving Ghostscript in this area.

Thanks for your input!