1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
From: Chris Liddell <chris.liddell@artifex.com>
Date: Tue, 11 Feb 2014 15:15:56 +0000 (+0000)
Subject: Bug 695031: don't assume we can read a font file
X-Git-Tag: ghostpdl-9.12rc1~50
X-Git-Url: http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff_plain;h=f4584b0e162a96ec143f0057de63c116e649e02b
Bug-Debian: https://bugs.debian.org/732440
Bug 695031: don't assume we can read a font file
When we scan system fonts, we were assuming fonts found would be in a format
Ghostscript understands. This is not necessarily the case.
So put the minimal parsing call to get the font's name in a stopped context,
so we can skip the file it's not an understandable format. And clean up the
stack in the event we try such a file.
No cluster differences.
Debian-Comment: This patch is part of Ghostscript > 9.07, which is
distributed under the GNU Affero General Public License (AGPL).
This patch was explicitely considered by its author to be "too small to be
copyright-protected", from
https://lists.debian.org/54AE3261.8000903@artifex.com :
> We'd have no problem with you patching an older, non-AGPL release with
> that - we'd regard it as being covered by your "a" case above. It's also
> a sufficiently obvious solution that any competent Postscript programmer
> would almost certainly come up with the same solution, which would make
> copyright enforcement decidedly questionable, too.
.
Where the "a" case was:
> a) consider your patch as too small to be copyright-protected. This
> would allow us to include is in GPL'd ghostscript 9.06. It'd be nice
> to have your confirmation on this though.
---
--- a/Resource/Init/gs_fonts.ps
+++ b/Resource/Init/gs_fonts.ps
@@ -385,12 +385,20 @@
pop pop pop
}{
% we could open the font file
- .findfontname
- not { dup 0 get } if % stack: (newname) [ (name) (path) ]
- % DEBUG { ( found ) print dup print (\n) print flush } if
- % add entry to the fontmap
- 1 index exch 0 exch dup type /nametype ne {cvn} if put
- aload pop .definefontmap
+ mark 2 1 roll
+ {.findfontname} stopped
+ {
+ cleartomark
+ pop pop
+ }
+ {
+ 3 -1 roll pop
+ not { dup 0 get } if % stack: (newname) [ (name) (path) ]
+ % DEBUG { ( found ) print dup print (\n) print flush } if
+ % add entry to the fontmap
+ 1 index exch 0 exch dup type /nametype ne {cvn} if put
+ aload pop .definefontmap
+ } ifelse
} ifelse
} forall
} if
|