Bug 690237

Summary: Regression: Missing and badly rendered images
Product: Ghostscript Reporter: Marcos H. Woehrmann <marcos.woehrmann>
Component: ImagesAssignee: Alex Cherepanov <alex>
Status: NOTIFIED FIXED    
Severity: normal    
Priority: P2    
Version: master   
Hardware: PC   
OS: Linux   
Customer: 850 Word Size: ---
Attachments: oo3i.pdf -- simolified sample file
patch

Description Marcos H. Woehrmann 2009-01-19 06:33:18 UTC
The attached PDF file is converted with images damaged with gs8.63 and head
(r9374) but works with gs8.54.  Regression testing shows the first revision that
failed is r8810:

------------------------------------------------------------------------
r8810 | alexcher | 2008-06-29 17:05:40 -0700 (Sun, 29 Jun 2008) | 8 lines

Add one more way to store data of the reusable stream: an array of strings.
Read the input stream into an array of strings during reusable stream
construction and use the array directly as a data storage.
Bug 689476, customer 190.

DIFFERENCES:
None

------------------------------------------------------------------------

The command line I'm using for testing:

  bin/gs -sDEVICE=tiff24nc -o test.tif ./25555.pdf
Comment 1 Marcos H. Woehrmann 2009-01-19 06:34:34 UTC
Created attachment 4734 [details]
25555.pdf
Comment 2 Alex Cherepanov 2009-01-20 05:32:49 UTC
Created attachment 4738 [details]
oo3i.pdf -- simolified sample file

This bug is not entirely a regression. The new implementation of the reusable
stream introduced relatively small stream buffer (1K), while previous
implementation kept the whole stream in a single block and used it as a stream
buffer.

Apparently, ICC profile reader cannot get the data correctly when the buffer is
small. The attached decompressed file doesn't render the image on any version
of Ghostscript. An decompression step appears to add missing steam access logic

to ICC reader.
Comment 3 Alex Cherepanov 2009-01-21 09:10:41 UTC
This is not an ICC bug. ICCBased color space can be changed into /DeviceRGB
without any visible affects. I didn't realize that masked image also uses
reusable streams but goes through a different branch.
Comment 4 Alex Cherepanov 2009-01-23 23:48:10 UTC
Created attachment 4758 [details]
patch

Keep reading the data sources until all of them reach EOF instead of bailing
out
when the first one reaches EOF. Different data sources can have different
compression techniques and buffer sizes. The mask in masked images also has
different length from other streams.

The patch makes PDF file generated from Bug689359.pdf render differently.
There are also some strange effects on 541_623.pdf .
Comment 5 Alex Cherepanov 2009-01-24 18:22:29 UTC
The differences in pdf file generated from Bug689359.pdf are progressions.
A wavy black line at the bottom of the image is now visible.

The differences in 541_623.pdf were, probably, caused by a hardware glitch.
I cannot reproduce them now.
Comment 6 Alex Cherepanov 2009-02-03 19:41:37 UTC
The patch is committed as a rev. 9444. 

s/Bug689359.pdf/Bug689369.pdf/g