Bug 689889

Summary: Image mask DataSource String no resused.
Product: Ghostscript Reporter: Michael Vrhel <michael.vrhel>
Component: PS InterpreterAssignee: Alex Cherepanov <alex>
Status: NOTIFIED FIXED    
Severity: normal    
Priority: P2    
Version: master   
Hardware: All   
OS: All   
Customer: 330 Word Size: ---
Bug Depends on:    
Bug Blocks: 689246    
Attachments: imagemask-with-pattern.ps

Description Michael Vrhel 2008-06-10 13:33:30 UTC
For the case of an Imagemask (in fact any imaging operator),  the interpreter
should reuse the string as needed to satisfy the imaging operation.  ( see page
291 of PLRM).    The attached example contains only 2 bytes of data, but the
imaging operation is expecting much more.  For the attached example, the stream
passes on the EOFC to the simscale.c filter (when you have -dDOINTERPOLATE).  
With a fix for bug 689888, this causes the filter to pass the EOFC on, which
will  make the ImageMask not to appear.  A solution would be to wrap the sting
data into a procedure when dealing with imaging operators, since the data should
be repeatedly read.  For the attached example,  /DataSource <00FF> becomes 
/DataSource { <00FF> }.  Thanks to Ray for stepping me through this.
Comment 1 Alex Cherepanov 2008-06-10 19:13:47 UTC
Please attach the sample file.
Comment 2 Michael Vrhel 2008-06-10 19:49:36 UTC
Created attachment 4089 [details]
imagemask-with-pattern.ps

In the file, changing /DataSource <00FF> to /DataSource {<00FF>} solves the
issue.	Sorry I forgot to attached it earlier.
Comment 3 Michael Vrhel 2008-06-21 04:11:16 UTC
The image interpolation in the source color space can not be properly tested
until this but is fixed.
Comment 4 Michael Vrhel 2008-07-01 05:50:33 UTC
Since this bug is blocking 689246 (a P2 level bug), I am bumping this up to the
same priority.  
Comment 5 Alex Cherepanov 2008-07-21 11:59:24 UTC
Wrap string data source into a procedure when /ImscaleDecode filter is
installed, to ensure repeated reading of the string when the imagemask
needs more data than has the string.

The following patch is committed as a rev. 8854.
http://ghostscript.com/pipermail/gs-cvs/2008-July/008435.html
Regression testing shows no differences.