Bug 687546 - pdfwrite : Type 3 glyph variations (was: ps2pdf segfaults)
Summary: pdfwrite : Type 3 glyph variations (was: ps2pdf segfaults)
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: master
Hardware: PC Linux
: P2 normal
Assignee: Igor Melichev
URL: http://lanl.arXiv.org/ftp/exports/fig...
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-25 20:52 UTC by keinbiervorvier
Modified: 2008-12-19 08:31 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
gzipped eps file which causes ps2pdf to segfault (192.84 KB, application/x-gzip)
2004-06-26 09:59 UTC, keinbiervorvier
Details
patch.txt (9.47 KB, patch)
2004-07-01 10:41 UTC, Igor Melichev
Details | Diff
patch.txt (1.34 KB, patch)
2004-07-01 10:44 UTC, Igor Melichev
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description keinbiervorvier 2004-06-25 20:52:58 UTC
this applies to current gs 8.30 cvs HEAD on RedHat Linux various versions (7.3
-- 9.0 -- FC2).

ps2pdf1(2|3|4) segfaults on the example file at the second invocation of the
DocumentSuppliedFont /_ArialUnicodeMS

gs 7.05 converts the sample file to valid pdf.

Cheers
T.
Comment 1 Alex Cherepanov 2004-06-26 03:22:20 UTC
Please attach a sample file to the bug report.
Comment 2 keinbiervorvier 2004-06-26 09:59:00 UTC
Created attachment 769 [details]
gzipped eps file which causes ps2pdf to segfault

sample file from http://lanl.arXiv.org/ftp/exports/fig_5.eps
attached as requested
Comment 3 Alex Cherepanov 2004-06-26 13:01:42 UTC
Please ignore my previous comment.
I didn't notice the URL entry.

The file has type 3 font that maintains a state and assumes that
BuildChar is executed for every character in the show string.
This assumption is correct bacause the characters use setcharwidth.
The bug can be easily verified by redefining "show" and adding debug
print to BuildChar
/show (dup == show} bind def
/BuildChar { dup 16 4 string cvrs == ... } def

PDF writer caches the character anyway and messes up the state.
Comment 4 Igor Melichev 2004-07-01 09:24:57 UTC
Please specify exact command line to reproduce the segfault. Raph with Linuh 
and me with Windows got "undefined in --get--". Please try the _current_ cvs 
HEAD.

In the last month pdfwrite in HEAD was patched with a proper handling of 
BuildChar/setcharwidth. It must execute for each glyph occurance, recognize 
glyph variations, and convert to multiple fonts in glyph variatipns appear.
Comment 5 Igor Melichev 2004-07-01 09:26:56 UTC
I meant that the last statement in the Comment #3 is obsolete.
Comment 6 Igor Melichev 2004-07-01 09:58:39 UTC
Hmm, I can see that with pdfwrite it doesn't execute BuildChar for the second 
occurance of '0'. Something is wrong in there.
Comment 7 keinbiervorvier 2004-07-01 10:01:17 UTC
I use the script ps2pdf13 as provided with gs.

With current cvs HEAD of 7/1/04 on RedHat 9.0 and Fedora Core 2 with
gcc 3.3.3 and gcc 3.4 I get

$ ps2pdf13 fig_5.eps
Error: /undefined in --get--
Operand stack:
   32   --dict:9/9(L)--   KBE20
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--  
--nostringval--   2   %stopped_push   --nostringval--   --nostringval--  
--nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3  
%oparray_pop   --nostringval--   1   3   %oparray_pop   1   3   %oparray_pop  
.runexec2   --nostringval--   --nostringval--   --nostringval--   2  
%stopped_push   --nostringval--   (0.03)   --nostringval--   %string_continue  
--nostringval--   --nostringval--   %finish_show   --nostringval--  
--nostringval--   7   11   1   --nostringval--   (pdf_text_enum_t)  
%op_show_continue   --nostringval--
Dictionary stack:
   --dict:1116/1686(ro)(G)--   --dict:0/20(G)--   --dict:93/200(L)--  
--dict:8/26(L)--   --dict:11/14(ro)(L)--   --dict:64/68(ro)(L)--  
--dict:15/20(ro)(L)--   --dict:20/29(L)--   --dict:47/50(L)--  
--dict:95/95(L)--   --dict:98/107(L)--
Current allocation mode is local
Last OS error: 2
Current file position is 432923
AFPL Ghostscript BETA RELEASE 8.30: Unrecoverable error, exit code 1

Cheers
Thorsten
Comment 8 Igor Melichev 2004-07-01 10:41:50 UTC
Created attachment 781 [details]
patch.txt

Attaching a suggested patch.
It passed related tests (687044, 687472, 687489, 687546) and is being tested
for regressions now.
Comment 9 Igor Melichev 2004-07-01 10:43:35 UTC
Comment on attachment 781 [details]
patch.txt

Oops, it's a wrong patch. Will attach another one.
Comment 10 Igor Melichev 2004-07-01 10:44:22 UTC
Created attachment 782 [details]
patch.txt

Attaching a suggested patch.
It passed related tests (687044, 687472, 687489, 687546) and is being tested
for regressions now.
Comment 11 Igor Melichev 2004-07-01 10:48:20 UTC
Changed the bug title because it was not represeb=ntative.