Bug 687772

Summary: /rangecheck error in --get-- with some idraw drawings
Product: Ghostscript Reporter: Ronan KERYELL <rk>
Component: PS InterpreterAssignee: Jack Moffitt <jack>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: 8.14   
Hardware: PC   
OS: Linux   
URL: http://www.lit.enstb.org/~keryell/gs/
Customer: Word Size: ---

Description Ronan KERYELL 2004-10-22 06:50:35 UTC
Since around gs version 7 some quite old drawings done with idraw no longer get
through.

For example with :
http://www.lit.enstb.org/~keryell/gs/CryptoPage-1_couleur.idraw
I get :
keryell@an-dro:~/public_html/gs$ gs-afpl CryptoPage-1_couleur.idraw
AFPL Ghostscript 8.14 (2004-02-20)
Copyright (C) 2004 artofcode LLC, Benicia, CA.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.

   **** Warning: Some of the BoundingBox for the EPS file will be clipped.
                 Use -dEPSCrop or -dEPSFitPage to avoid clipping.

Loading NimbusSanL-Bold font from
/var/lib/defoma/gs.d/dirs/fonts/n019004l.pfb... 2507972 951049 1496676 197430 2
done.
Error: /rangecheck in --get--
Operand stack:
   --nostringval--   --nostringval--   --nostringval--   descender   0  
--nostringval--   1
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-- --nostringval--
Dictionary stack:
   --dict:1112/1686(ro)(G)--   --dict:0/20(G)--   --dict:81/200(L)--  
--dict:36/51(L)--   --dict:1/17(L)--   --dict:5/17(L)--   --dict:1/3(L)--  
--dict:16/17(ro)(L)--
Current allocation mode is local
Current file position is 14641
AFPL Ghostscript 8.14: Unrecoverable error, exit code 1

If I group the objects in idraw (you can do this by typing "ag") there is no
error longer.
See :
http://www.lit.enstb.org/~keryell/gs/CryptoPage-1_couleur-group.idraw

It is cumbersome to modify all my old drawing I use gs in my courses and my
articles on an every day basis to translate PS to PDF throug ps2pdf...

I use idraw and gs for so long time can't remember... :-) Maybe around 1990.

I've tested with different version of gs (gs-gpl, gs-afpl) on Debian/Linux
unstable and they behave the same way.

If you need to use idraw you can install the Debian package ivtools-bin or have
a look at :
http://www.ivtools.org/ivtools/index.html

Thanks a lot if you can fix this misbehaviour !
Comment 1 Jack Moffitt 2004-10-24 21:41:35 UTC
Both of the referenced files work fine for me in GS 8.14 and CVS HEAD.  Do you
have any further info?
Comment 2 Jack Moffitt 2004-10-25 09:47:18 UTC
You might also try a newer version of Ghostscript such as 8.15.
Comment 3 Ronan KERYELL 2004-10-25 23:58:01 UTC
After trying even another Linux kernel version :-) and strace-ing many gs I've
tracked down the issue with a font file in the Debian gsfonts package,
/var/lib/defoma/gs.d/dirs/fonts/n019004l.pfb that is a link to
/usr/share/fonts/type1/gsfonts/n019004l.pfb.
I've added a good and a bug-triggering version of this file in 
http://www.lit.enstb.org/~keryell/gs/

It looks like it is the same bug as
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=242015

So, is it a bug in the fonts or in gs ?
Since the same fonts are used in the 2 drawings, grouped or non-grouped, I will
rather suspect a gs bug...
Comment 4 Alex Cherepanov 2005-01-07 16:32:55 UTC
The bug is mainly in idraw that assumes that FontBBox is an executable array. 
This happens only when v. 8.11 of Ghostscript fonts is installed, because fonts
use literal array for the FontBBox.

The literal FontBBox evaluates to itself instead of 4 numbers.
An attempt to take 1st element (0-based) of 1-element array is a run-time
PostScript error.

The files generated by old idraw cannot be fixed 
using idiom recignition because the offending procedure is not bound.
The file can be patched using any text editor, for instance
sed "s|\[FontBBox\]|/FontBBox load |" <foo.ps >foo-fixed.ps

We should consider using executable arrays in fonts because some
(incorrect) programs depend on this and we gain nothing from the literary
status of FontBBox. See bug 687297 .


*** This bug has been marked as a duplicate of 687120 ***