Bug 47776

Summary: [PATCH] ports/print/gv broken by recent security update
Product: Ports & Packages Reporter: Thomas Moestl <tmm>
Component: Individual Port(s)Assignee: freebsd-ports-bugs mailing list <ports-bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Thomas Moestl freebsd_committer 2003-02-01 00:30:15 UTC
	The recent security update added a patch from Debian, which
	breaks gv for some previously working PostScript documents.
	The problem is the following change in the gv_3.5.8-26.1.diff.gz
	(from security.debian.org):

	+#define IS_END(comment)                                \
	+           (iscomment(line+5,(comment)))
	[...]
	-   else if IS_BEGIN("Document:")  SKIP_UNTIL_1("EndDocument")
	+   else if IS_BEGIN("Document:")  {  /* Skip the EPS without handling its content */
	+            while (line && !IS_END("Document")) {
	+               line = ps_io_fgetchars(fd,-1);
	+               if (line) *line_lenP += FD_LINE_LEN;
	+            }
	+   }

	It seems to be intended to handle embedded EPS files with
	unclosed sections. However, it has two problems: first, it does
	not check that the line in question is really an
	"%%EndDocument" comment, only that it contains the string
	"Document", starting on the fifth character on the line,
	which happens to occur in unrelated places in the problematic
	documents. This desynchronizes the rest of the file reader,
	and it will interpret the trailer/EOF of the embedded document
	as end of the parent document.
	Secondly, it does not skip over the the %%EndDocument line;
	this is non-fatal though.
	The attached patch should fix it. In case it gets mangled,
	a copy is at 'http://people.freebsd.org/~tmm/patch-source::ps.c'.

How-To-Repeat: 	An example of a broken document is
	http://www.sparc.com/standards/v9.ps.Z - only the first 3
	pages will be displayed.
Comment 1 Christian Weisgerber freebsd_committer 2003-02-12 01:11:47 UTC
State Changed
From-To: open->closed

Committed, thanks!