Bug 688631 - Transparency: PDF segfault
Summary: Transparency: PDF segfault
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: master
Hardware: PC Windows XP
: P2 normal
Assignee: leonardo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-04 13:29 UTC by Ralph Giles
Modified: 2008-12-19 08:31 UTC (History)
0 users

See Also:
Customer: 330
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Giles 2006-04-04 13:29:53 UTC
Customer reports gswin32c.exe (the official 8.53 build) sefaults on the attached
file.

I cannot reproduce on linux, but Dan has confirmed with 8.53 and HEAD on Windows.
Comment 1 Ralph Giles 2006-04-04 13:32:36 UTC
Created attachment 2143 [details]
problem file
Comment 2 Dan Coby 2006-04-04 14:21:40 UTC
The seg fault is coming from the memcopy in the following sequence in 
pdf14_push_transparency_group in gdevp14.c.  The width and pointers seem 
reasonable at fist glance.

	for (i = 0; i < n_chan_copy; i++) {
	    byte *buf_ptr = buf_plane;
	    byte *tos_ptr = tos_plane;
	    int y;

	    for (y = y0; y < y1; ++y) {
		memcpy (buf_ptr, tos_ptr, width); 
		buf_ptr += buf->rowstride;
		tos_ptr += tos->rowstride;
	    }
	    buf_plane += buf->planestride;
	    tos_plane += tos->planestride;
	}
Comment 3 Alex Cherepanov 2006-04-05 09:06:07 UTC
I got a C stack overflow on Windows NT, MSVC 6.
Comment 4 Dan Coby 2006-04-05 09:14:43 UTC
The problem is that the bounding rectangles for the two buffers do not match.  
As a result, the memcopy is attempting to move data from before the start of 
the tos_ptr area.
Comment 5 Dan Coby 2006-08-16 10:05:01 UTC
Igor,

Would you please check the logic for determining the bounding boxes.
Comment 6 leonardo 2006-09-05 14:10:39 UTC
Patch to HEAD :
http://ghostscript.com/pipermail/gs-cvs/2006-September/006783.html
Comment 7 leonardo 2006-09-21 05:48:35 UTC
Another crash in transparency happen with -dPDFA. I guess the branch, which 
converts a transparency into a bitmap, needs a similar improvement.

gswin32c.exe -dPDFA -dNOPAUSE  -dBATCH -sDEVICE=pdfwrite -sOutputFile=z:\t2
\cur.pdf -dLastPage=10 CompareFiles\Bug688631.pdf
The test file is same as one attached.
Comment 8 leonardo 2006-09-21 12:23:31 UTC
One more patch to HEAD :
http://ghostscript.com/pipermail/gs-cvs/2006-September/006825.html