[gs-bugs] [Bug 692309] GS segfault on some PDF files when compiled with '--disable-compile-init'

bugzilla-daemon at ghostscript.com bugzilla-daemon at ghostscript.com
Wed Jun 29 09:22:28 UTC 2011


http://bugs.ghostscript.com/show_bug.cgi?id=692309

--- Comment #10 from Vladimir Lomov <lomov.vl at gmail.com> 2011-06-29 09:22:27 UTC ---
(In reply to comment #9)
[...]

> > [terminal]
> > gs -q -dNOPAUSE -dBATCH -I/usr/share/ghostscript/9.03/ -sDEVICE=pdfwrite
> > -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100
> > -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER
> > -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964
> > -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
> > sfopen: gs_parse_file_name failed.
> > sfopen: gs_parse_file_name failed.
> >   ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find
> > default_rgb.icc 
> > | ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device
> > profile
> > Ошибка сегментирования
> > [/terminal]
> > 
> > [terminal]
> > gs -q -dNOPAUSE -dBATCH -sGenericResourceDir -sDEVICE=pdfwrite -dEPSCrop
> > -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100
> > -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER
> > -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964
> > -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
> > GenericResourceDir value does not end with directory separator.
> 
> You actually have to set GenericResourceDir to the location of the 'Resource'
> directory that GS is to use. Or, set -I to the same directory. 
> 
> GenericResourceDir is documented in gs/doc/Use.htm.
> 
> Setting it incorrectly is what leads to the following error:
[...]
Understand

> > $ LANG=C ls -lA /usr/share/ghostscript/9.03/
> > total 7
> > drwxr-xr-x 9 root root  224 Jun 29 09:06 Resource
> > drwxr-xr-x 2 root root 1424 Jun 29 09:11 doc
> > drwxr-xr-x 3 root root  480 Jun 29 09:11 examples
> > drwxr-xr-x 2 root root  320 Jun 29 09:11 iccprofiles
> > drwxr-xr-x 2 root root 5720 Jun 29 09:11 lib
> > [/terminal]
> > 
> > I attached output from 'gs --help' from 9.02 and git ver.
> 
> The search path shows that your system is currently set up to use the 89.02
> resources and initialisation files, this could be the source of the problem.

I don't understand.
The ver. compiled from git repo has the same directory structure as 9.02 (I
compare self compiled package and distro one): there is directory
`/usr/share/ghostscript/VER' (VER=9.03 and 9.02 resp.) which has following
subdirs:
Resources/
doc/
examples/
iccprofiles/
lib/
and this structure was created by `make install soinstall'.

> 
> Try setting 
> 
> -sGenericResourceDir=/usr/share/ghostscript/9.03/Resource/
> 
> You do need the trailing forward slash.
> 
> Or
> 
> -I/usr/share/ghostscript/9.03/Resource
> 

Here:
[terminal]
gs -q -dNOPAUSE -dBATCH
-sGenericResourceDir=/usr/share/ghostscript/9.03/Resource/ -sDEVICE=pdfwrite
-dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100
-dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER
-dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964
-dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find
default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device
profile
Ошибка сегментирования
[/terminal]

[terminal]
gs -q -dNOPAUSE -dBATCH -sGenericResourceDir=/usr/share/ghostscript/9.03/
-sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true
-dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER
-dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964
-dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps

*** Warning: GenericResourceDir doesn't point to a valid resource directory.
               the -sGenericResourceDir=... optionsfopen: gs_parse_file_name
failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find
default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device
profile
Ошибка сегментирования
[/terminal]
(I think this is expected result)

[terminal]
gs -q -dNOPAUSE -dBATCH -I/usr/share/ghostscript/9.03/Resource
-sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true
-dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER
-dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964
-dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find
default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device
profile
Ошибка сегментирования
[/terminal]

Run the same command under gdb:
[terminal]
gdb gs
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/gs...(no debugging symbols found)...done.
(gdb) run -q -dNOPAUSE -dBATCH
-sGenericResourceDir=/usr/share/ghostscript/9.03/Resource/ -sDEVICE=pdfwrite
-dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100
-dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER
-dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964
-dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
Starting program: /usr/bin/gs -q -dNOPAUSE -dBATCH
-sGenericResourceDir=/usr/share/ghostscript/9.03/Resource/ -sDEVICE=pdfwrite
-dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100
-dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER
-dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964
-dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
[Thread debugging using libthread_db enabled]
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find
default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device
profile

Program received signal SIGSEGV, Segmentation fault.
0x000000000055d186 in ?? ()
(gdb) backtrace
#0  0x000000000055d186 in ?? ()
#1  0x0000000000660fc1 in ?? ()
#2  0x00000000006612b6 in ?? ()
#3  0x0000000000661c6d in ?? ()
#4  0x000000000066231c in psdf_setup_image_filters ()
#5  0x00000000006a96ab in ?? ()
#6  0x00000000006a9d2a in ?? ()
#7  0x00000000006aa65e in gdev_pdf_begin_typed_image ()
#8  0x000000000079271d in gs_image_begin_typed ()
#9  0x00000000004fae4e in zimage_setup ()
#10 0x00000000004fb3e1 in image1_setup ()
#11 0x00000000004c8eb1 in ?? ()
#12 0x00000000004ca623 in gs_interpret ()
#13 0x00000000004bf5c3 in gs_main_run_string_end ()
#14 0x00000000004c032b in ?? ()
#15 0x00000000004c0491 in ?? ()
#16 0x00000000004c230f in gs_main_init_with_args ()
#17 0x0000000000457bd4 in main ()
[/terminal]
(Seems the same output as w/o '-sGene...')

master Git commit '865dca5781dcb4fea12d1349d4f7392d7d809c42' at the moment.

> For me either of these works (with different paths obviously).

I'm lost...

P.S. Why this spurious message?
[quote]
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find
default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device
profile
[/quote]

Even if I add '-sICCProfilesDir' and run
[terminal]
gs -q -dNOPAUSE -dBATCH
-sGenericResourceDir=/usr/share/ghostscript/9.03/Resource/
-sICCProfilesDir=/usr/share/ghostscript/9.03/iccprofiles/ -sDEVICE=pdfwrite
-dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100
-dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER
-dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964
-dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find
default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device
profile
Ошибка сегментирования
[/terminal]
I get 'Could not find...' (w/o trailing slash I get more warnings).

Only if I manually copy default_rgb.icc and default_gray.icc to the current
directory then I get
[terminal]
gs -q -dNOPAUSE -dBATCH -I. -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true
-dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress
-dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792
-dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657
-sOutputFile=logimage.pdf logimage_.eps
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
[/terminal]
w/o segfault.

-- 
Configure bugmail: http://bugs.ghostscript.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the gs-bugs mailing list