Bug 687608 - All resources must be bound.
Summary: All resources must be bound.
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Resource (show other bugs)
Version: master
Hardware: All All
: P4 minor
Assignee: Alex Cherepanov
URL:
Keywords: bountiable
: 687928 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-08-07 13:06 UTC by Alex Cherepanov
Modified: 2011-03-10 07:41 UTC (History)
2 users (show)

See Also:
Customer:
Word Size: ---


Attachments
patch for Default* color spaces. (2.04 KB, patch)
2004-08-07 13:07 UTC, Alex Cherepanov
Details | Diff
Test case load-allres.ps (1.13 KB, text/plain)
2004-08-25 09:04 UTC, Alex Cherepanov
Details
patch (129.44 KB, patch)
2004-11-27 05:26 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Cherepanov 2004-08-07 13:06:17 UTC
PostScript programmer should not worry about the
local variables affecting the normal operation of the PS
interpreter. Unfortunately, this is not the case when
resourcas are not bound.

Attached is a patch for the ColorSpace category.
Probably, we need a test case that enumerates all resource categories,
enumerates and loads all resources and checks, whether the resource
is affected by the definition in userdict.
Comment 1 Alex Cherepanov 2004-08-07 13:07:41 UTC
Created attachment 838 [details]
patch for Default* color spaces.
Comment 2 Ray Johnston 2004-08-11 09:50:53 UTC
The 'bind' operator only recursively binds procedures, so the patch
doesn't do anything:

-     /DecodeLMN  [ { 1.8 exp } { 1.8 exp } { 1.8 exp } ]  def
+     /DecodeLMN  [ { 1.8 exp } { 1.8 exp } { 1.8 exp } ] bind def

should be:

-     /DecodeLMN  [ { 1.8 exp } { 1.8 exp } { 1.8 exp } ]  def
+     /DecodeLMN  [ { 1.8 exp } bind { 1.8 exp } bind { 1.8 exp } bind ] def

or for conciseness:

-     /DecodeLMN  [ { 1.8 exp } { 1.8 exp } { 1.8 exp } ]  def
+     /DecodeLMN  [ { 1.8 exp } bind dup dup ] def

Comment 3 Alex Cherepanov 2004-08-11 19:19:53 UTC
The following experiment shows that the original patch works
although "{ 1.8 exp } bind dup dup" is better indeed.

GS>[{add}] bind ==
[{--add--}]
Comment 4 Alex Cherepanov 2004-08-25 08:59:44 UTC
The modified patch is committed to the HEAD branch.
Comment 5 Alex Cherepanov 2004-08-25 09:04:31 UTC
Created attachment 862 [details]
Test case load-allres.ps

Attached is a test file that enumerates all resources in all categories,
loads themand searches for executable names.

The test shows that many names in Font CIDFont and related resource
categories are not bound.
Comment 6 Ray Johnston 2004-10-26 11:04:49 UTC
Seems like Alex has a handle on this and if he or anyone else wants
to do the (sort of tedious) work, we will pay the bounty.
Comment 7 Alex Cherepanov 2004-11-27 05:26:38 UTC
Created attachment 1059 [details]
patch

Bind all operators, true, false, null, =string, systemdict, globaldict,
userdict
in all gs_*.ps files.
Comment 8 Alex Cherepanov 2005-02-05 04:06:01 UTC
*** Bug 687928 has been marked as a duplicate of this bug. ***
Comment 9 Alex Cherepanov 2011-03-10 07:41:16 UTC
Rev. 12268 has finally changed all null, true, and false to
immediately evaluated names. There may be other cases of
name look-up but none have caused any problems so far.