Bug 694811

Summary: Pdf Interpreter hangs in 9.10. Works fine in 9.07.
Product: Ghostscript Reporter: wilfried
Component: Graphics LibraryAssignee: Michael Vrhel <michael.vrhel>
Severity: normal    
Priority: P4    
Version: 9.10   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: Pdf Document producing blocker.

Description wilfried 2013-11-27 06:59:15 UTC
Created attachment 10425 [details]
Pdf Document producing blocker.

Following command:

/bin/gs -dPDFDEBUG -dMaxBitmap=0 -sDEVICE=pngalpha -q -dNOPAUSE -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dUseCropBox -r300x300 -dFirstPage=1 -dLastPage=1 -sOutputFile="./tmp/Tomaten.pdf_0001.png" -c 0 0 translate -dSAFER "./tmp/Tomaten.pdf" -c showpage -c quit

Stops in outputting Debug messages with:

%Resolving: [266 0]
/T1_6 1 Tf
%Resolving: [131 0]
17.8658 2.1936 -2.1936 17.8658 1733.27161 1017.75739 Tm
(T) 98 (ext n) 19 (ur P) 5 (l) -3 (a) 19 (tzh) 3 (a) -5 (l) 12 (t) 6 (er) ]

Thanks in advance
Comment 1 Ken Sharp 2013-11-27 08:15:26 UTC
The problem only exhibits with the pngalpha device, and is transparency related, nothing to do with the PDF interpreter.

A much simpler command line '-sDEVICE=pngalpha -sOutputFile=out.png' is sufficient.

Michael, in gdevp14.c around line 2411 I see:

                    if (overprint) {
                        if (blendspot) {
                            /* Overprint simulation of spot colorants */
                            for (k = 0; k < num_comp; ++i) {
                                int temp = 
                                    (255 - dst_ptr[k * planestride]) * dst[k];
                                temp = temp >> 8;
                                dst_ptr[k * planestride] = (255 - temp);

Notice the loop runs from k=0 to k=num_comps, but the counter which is incremented is 'i', which is not used in this loop, hence we endlessly cycle.

Naively modifying this to '++k' (which matches the other loops) and the file runs to completion, the output appears broadly correct (its a large complex page so its hard to be certain). However since its not my code I have no idea if this is correct.