Re: Fix for Bug#686903, GS fails on a file by Quartz PDFContext.

"Igor V. Melichev" <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
Fine with me.

Igor.

----- Original Message ----- 
From: "Jeong Kim" <[email protected]>
To: "'gs-code-review'" <[email protected]>
Sent: Saturday, August 16, 2003 4:43 PM
Subject: [gs-code-review] Fix for Bug#686903, GS fails on a file by Quartz
PDFContext.


> Reviewers,
>
> One of the partially embedded TrueType font in the given test file has
> wrong
> 'name' table entry and this causes an error.
>
> In detail, as the 'name' table record index for the font is wrong,
> /findname procedure
> fails to get the font name record. At line 220 in gs_ttf.ps,
> 'getinterval' operator tries
> to get the name string with the given index and count values, but the
> index value is
> greator than the length of the whole 'name' table data and a rangecheck
> error occurs.
>
> To fix this problem, I added a condition-check code prior to the
> 'getinterval' operator.
> If sum of the index and the count values for 'getinterval' operator is
> greator than the
> length of the whole 'name' table data, /findname procedure now returns
> 'false' as an
> output. Now with this fix, the given test file is processed without any
> errors.
>
> Jeong
>
> Log:
> When a PDF file has an embedded TrueType font with wrong 'name' table
> entry,
> /findname procedure in gs_ttf.ps throwed a rangecheck error.
> Now it just returns 'false' as an output instead of making rangecheck
> error.
> Bug# 686903.
>
> Index: lib/gs_ttf.ps
> ===================================================================
> RCS file: /cvs/ghostscript/gs/lib/gs_ttf.ps,v
> retrieving revision 1.31
> diff -r1.31 gs_ttf.ps
> 219,222c219,231
> <       1 index 8 getu16 4 -1 roll 3 1 roll getinterval exch
> <               % Stack: false string record
> <               % Check for 8- vs. 16-bit characters.
> <       is2byte { string2to1 } if true null 4 -1 roll exit
> ---
> >       1 index 8 getu16 4 -1 roll 3 1 roll
> >         3 copy add 1 index length
> >         le {
> >           pop
> >           getinterval exch
> >               % Stack: false string record
> >               % Check for 8- vs. 16-bit characters.
> >         is2byte { string2to1 } if true null 4 -1 roll exit
> >         } {
> >           pop pop pop pop
> >           false
> >               exit
> >         } ifelse
>
> _______________________________________________
> gs-code-review mailing list
> [email protected]
> http://www.ghostscript.com/mailman/listinfo/gs-code-review
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.