diff --git a/Add-python3-support.patch b/Add-python3-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..32759fafbcee731800c905723a087d4514c966ef --- /dev/null +++ b/Add-python3-support.patch @@ -0,0 +1,519 @@ +From b2c5de7835a753cad1f35db8202c4733b5fc2990 Mon Sep 17 00:00:00 2001 +From: Parag A Nemade +Date: Mon, 3 Oct 2016 12:56:29 +0530 +Subject: [PATCH] Add python3 support + +Signed-off-by: Parag A Nemade +--- + pycontrib/FontCompare/fc/BitmapHandler.py | 20 +++++++-------- + pycontrib/FontCompare/fc/DocCompare.py | 2 +- + pycontrib/FontCompare/fc/FontCompare.py | 2 +- + pycontrib/FontCompare/fc/GlyphConsistency.py | 2 +- + pycontrib/FontCompare/fontcompare | 2 +- + pycontrib/FontCompare/unittests/unittests.py | 18 ++++++------- + pycontrib/collab/web-test-collab.py | 2 +- + pycontrib/even.py | 2 +- + pycontrib/gdraw/__init__.py | 4 +-- + pycontrib/gdraw/gdraw.py | 20 +++++++-------- + pycontrib/graphicore.py | 4 +-- + pycontrib/graphicore/ipython_view.py | 13 +++++----- + pycontrib/graphicore/shell.py | 4 +-- + pycontrib/svg2sfd.py | 38 ++++++++++++++-------------- + pycontrib/webcollab.py | 6 ++--- + 15 files changed, 70 insertions(+), 69 deletions(-) + +diff --git a/pycontrib/FontCompare/fc/BitmapHandler.py b/pycontrib/FontCompare/fc/BitmapHandler.py +index d4d00da..c159128 100644 +--- a/pycontrib/FontCompare/fc/BitmapHandler.py ++++ b/pycontrib/FontCompare/fc/BitmapHandler.py +@@ -35,7 +35,7 @@ def white_bg_square(img): + "return a white-background-color image having the img in exact center" + size = (max(img.size),)*2 + layer = Image.new('1', size, 1) +- layer.paste(img, tuple(map(lambda x:(x[0]-x[1])/2, zip(size, img.size)))) ++ layer.paste(img, tuple([(x[0]-x[1])/2 for x in zip(size, img.size)])) + return layer + + class BitmapCompare: +@@ -73,13 +73,13 @@ class CreateSpriteSheet: + #seperate each image with lots of whitespace + master_height = pixelsize + oldfont = font +- print "the master image will by %d by %d" % (master_width, master_height) +- print "creating image..." ++ print("the master image will by %d by %d" % (master_width, master_height)) ++ print("creating image...") + master = Image.new( + mode='1', + size=(master_width, master_height), + color=0) # fully transparent +- print "created." ++ print("created.") + if effects == "italic": + font.selection.all() + font = font.italicize(-13) +@@ -92,16 +92,16 @@ class CreateSpriteSheet: + font[i].changeWeight(50,"auto",0,0,"auto") + font[i].export("temp.bmp",pixelsize,1) + img = Image.open("temp.bmp") +- print "adding %s at %d..." % (str(i)+".bmp", location), ++ print("adding %s at %d..." % (str(i)+".bmp", location), end=' ') + square_one = white_bg_square(img) + square_one.resize((pixelsize, pixelsize)) + master.paste(square_one,(location,0)) +- print "added." ++ print("added.") + except: +- print "ooopsy" ++ print("ooopsy") + count+=1 +- print "done adding pics." +- print "saving mastersprite.bmp..." ++ print("done adding pics.") ++ print("saving mastersprite.bmp...") + master.save('data/mastersprite'+effects+'.bmp' ) +- print "saved!" ++ print("saved!") + font.close() +diff --git a/pycontrib/FontCompare/fc/DocCompare.py b/pycontrib/FontCompare/fc/DocCompare.py +index 3a54bf9..df431e2 100644 +--- a/pycontrib/FontCompare/fc/DocCompare.py ++++ b/pycontrib/FontCompare/fc/DocCompare.py +@@ -41,7 +41,7 @@ class DocCompare: + bashcommand = "hb-view --output-format=\"png\" --output-file=\"/var/tmp/test.png\" --font-size="+str(fontsize)+" --text-file=\"" + bashcommand+=docpath+"\" "+"\""+testpath+"\"" + os.system(str(bashcommand)) +- print bashcommand ++ print(bashcommand) + thefile = pkg_resources.resource_filename("fc",mockfont.highresdocfile) + shutil.copy(thefile,"/var/tmp/standard.png") + cm = BitmapCompare() +diff --git a/pycontrib/FontCompare/fc/FontCompare.py b/pycontrib/FontCompare/fc/FontCompare.py +index f21718c..c82b788 100644 +--- a/pycontrib/FontCompare/fc/FontCompare.py ++++ b/pycontrib/FontCompare/fc/FontCompare.py +@@ -111,7 +111,7 @@ class FontCompare(object): + scores = list() + comparator = BitmapCompare() + pixelsize = (resolution*ptsize)/72 +- print spritepath ++ print(spritepath) + for i in range (glyphRange[0],glyphRange[1]): + if i in Testfont: + Testfont[i].export("/var/tmp/tmp.bmp",pixelsize,1) +diff --git a/pycontrib/FontCompare/fc/GlyphConsistency.py b/pycontrib/FontCompare/fc/GlyphConsistency.py +index 38273c9..d5265fa 100644 +--- a/pycontrib/FontCompare/fc/GlyphConsistency.py ++++ b/pycontrib/FontCompare/fc/GlyphConsistency.py +@@ -102,7 +102,7 @@ class GlyphConsistency: + for i in range (glyphrange[0],glyphrange[1]): + if i in font: + score = self.glyph_round_compare(font[i],pixelsize) +- print score ++ print(score) + set_round_score+=score + total+=1 + font.close() +diff --git a/pycontrib/FontCompare/fontcompare b/pycontrib/FontCompare/fontcompare +index e7e68d8..fdf7336 100755 +--- a/pycontrib/FontCompare/fontcompare ++++ b/pycontrib/FontCompare/fontcompare +@@ -15,7 +15,7 @@ + along with this program. If not, see . + """ + +-#! /usr/bin/python ++#! /usr/bin/python3 + from PyQt4.QtGui import QMessageBox + from PyQt4.QtGui import QMainWindow + from PyQt4.QtGui import QApplication +diff --git a/pycontrib/FontCompare/unittests/unittests.py b/pycontrib/FontCompare/unittests/unittests.py +index 18e1e95..d8a1190 100644 +--- a/pycontrib/FontCompare/unittests/unittests.py ++++ b/pycontrib/FontCompare/unittests/unittests.py +@@ -55,7 +55,7 @@ class Basictests(unittest.TestCase): + for tup in basic: + if tup[1]!=10: + bastest=0 +- self.failUnless(bastest) ++ self.assertTrue(bastest) + testfont = fontforge.open("unittests/lohit.ttf") + bold = cm.font_facecompare(testfont,mockfont,(0x900,0x97f),\ + 600,12,1,"bold") +@@ -66,28 +66,28 @@ class Basictests(unittest.TestCase): + normal = cm.font_facecompare(testfont,mockfont,(0x900,0x97f),\ + 600,12,1,"normal") + test = 1 +- print len(normal) ++ print(len(normal)) + for tup in bold: + if tup[1]==100 or tup[1]==0: + test1=1 + break +- self.failUnless(test) ++ self.assertTrue(test) + test = 0 + for tup in italic: + if tup[1]==100 or tup[1]==0: + test=1 + break +- self.failUnless(test is 1) ++ self.assertTrue(test is 1) + test = 0 + for tup in normal: + if tup[1]==100 or tup[1]==0: + test=1 + break +- self.failUnless(test is 1) ++ self.assertTrue(test is 1) + test = 0 + if len(normal) == len(bold) == len(italic): + test = 1 +- self.failUnless(test is 1) ++ self.assertTrue(test is 1) + + def testGlyphConsistency(self): + cm = GlyphConsistency() +@@ -99,11 +99,11 @@ class Basictests(unittest.TestCase): + test3 = cm.glyph_round_consistency(testfont,(0x900,0x97f),50) + + test = (0 <= test1[0][1] <= 10) +- self.failUnless(test) ++ self.assertTrue(test) + test2 = (0 <= test2 <= 10) +- self.failUnless(test2) ++ self.assertTrue(test2) + test3 = (0 <= test3 <= 10) +- self.failUnless(test3) ++ self.assertTrue(test3) + + """ + unittests for DocCompare not required. +diff --git a/pycontrib/collab/web-test-collab.py b/pycontrib/collab/web-test-collab.py +index 47b763f..b19f930 100755 +--- a/pycontrib/collab/web-test-collab.py ++++ b/pycontrib/collab/web-test-collab.py +@@ -68,7 +68,7 @@ def OnCollabUpdate(f): + "end": "null" # this is simply so we dont have to manage keeping the last item with no terminating , + }, + sort_keys=True, indent=4, separators=(',', ': ')) +- print js ++ print(js) + fi = open(fontJsonOnDisk, 'w') + fi.write(js) + +diff --git a/pycontrib/even.py b/pycontrib/even.py +index 96f9128..4f30fcb 100755 +--- a/pycontrib/even.py ++++ b/pycontrib/even.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # -*- coding: utf-8 -*- + """ + running even from the fontforge menu +diff --git a/pycontrib/gdraw/__init__.py b/pycontrib/gdraw/__init__.py +index d47976c..dde7ea8 100644 +--- a/pycontrib/gdraw/__init__.py ++++ b/pycontrib/gdraw/__init__.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # vim:ts=8:sw=4:expandtab:encoding=utf-8 + ''' + Copyright 2009 +@@ -22,7 +22,7 @@ Copyright 2009 + __all__ = ['Timer', 'GtkRunner', 'gtkrunner'] + __version__ = '0.1' + +-from gdraw import * ++from .gdraw import * + + def main(): + pass +diff --git a/pycontrib/gdraw/gdraw.py b/pycontrib/gdraw/gdraw.py +index f2d5e50..8b6e693 100755 +--- a/pycontrib/gdraw/gdraw.py ++++ b/pycontrib/gdraw/gdraw.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + '''ctypes wrapper to Attach the GDraw event handler to the gtk main loop. + + Copyright 2009 +@@ -67,7 +67,7 @@ def setup_syspath(modpath="modules"): + + __all__ = ['Timer', 'GtkRunner', 'gtkrunner'] + +-from _gdraw import * ++from ._gdraw import * + from ctypes import * + import types + +@@ -111,7 +111,7 @@ class Timer: + + return + def dodo(*args): +- print 'aaa' ++ print('aaa') + return False + self.add(1000, dodo) + +@@ -122,7 +122,7 @@ class Timer: + + def _event_handler(self, gw, event): + evt = event.contents +- print "_event_handler()" ++ print("_event_handler()") + if evt.type == et_timer: + timer = evt.u.timer.timer + tkey = addressof(timer.contents) +@@ -147,7 +147,7 @@ class Timer: + ci.func = CallBackFunc(func) + ci.data = data + +- print "timer.add timeout", timeout ++ print("timer.add timeout", timeout) + frequency = 1 # Use return value of func() to decide repeat like gtk. + timer = GDrawRequestTimer(self.win, timeout, timeout, byref(ci)) + +@@ -190,7 +190,7 @@ class GtkRunner: + + def _do_main(self, *args): + '''The function called by the gdraw timeout handler.''' +- print "do_main" ++ print("do_main") + while gtk.events_pending(): + gtk.main_iteration(False) + return True +@@ -207,15 +207,15 @@ class GtkRunner: + self.gtk_timer = None + + def OnDestroyWindow(self, widget, fd ): +- print fd ++ print(fd) + fontforge.removeGtkWindowToMainEventLoopByFD( fd ) + self.stop() + return True + + def sniffwindow(self,w): + '''sniff key presses for a gtk window''' +- print "sniffwindow w", w +- print "sniff active font:", fontforge.activeFont() ++ print("sniffwindow w", w) ++ print("sniff active font:", fontforge.activeFont()) + w.connect("key-release-event", self._do_main) + fontforge.addGtkWindowToMainEventLoop(w.window.xid) + fd = fontforge.getGtkWindowMainEventLoopFD(w.window.xid) +@@ -223,7 +223,7 @@ class GtkRunner: + + def sniffwindowid(self,xid): + '''sniff key presses for a gtk window''' +- print "sniffwindowid xid", xid ++ print("sniffwindowid xid", xid) + #w.connect("key-release-event", self._do_main) + + def start(self, timeout=GTIMEOUT): +diff --git a/pycontrib/graphicore.py b/pycontrib/graphicore.py +index f95e488..229a2b7 100755 +--- a/pycontrib/graphicore.py ++++ b/pycontrib/graphicore.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # -*- coding: utf-8 -*- + """ + running the fontforge scripts in the graphicore folder on fontforge startup +@@ -22,4 +22,4 @@ sys.path.append(os.path.dirname(sys.modules[__name__].__file__)) + sys.path.reverse(); + + #load the modules +-import graphicore.shell +\ No newline at end of file ++import graphicore.shell +diff --git a/pycontrib/graphicore/ipython_view.py b/pycontrib/graphicore/ipython_view.py +index f39eedb..2b77395 100644 +--- a/pycontrib/graphicore/ipython_view.py ++++ b/pycontrib/graphicore/ipython_view.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + ''' + Provides IPython console widget. + +@@ -17,10 +17,11 @@ import re + import sys + import os + import pango +-from StringIO import StringIO +-import thread ++from io import StringIO ++import _thread + + import IPython ++from functools import reduce + + class IterableIPShell: + ''' +@@ -118,7 +119,7 @@ class IterableIPShell: + ''' + This function updates namespace with sys.modules + ''' +- for k,v in sys.modules.items(): ++ for k,v in list(sys.modules.items()): + if not '.' in k: + self.IP.user_ns.update({k:v}) + +@@ -271,11 +272,11 @@ class IterableIPShell: + @type header: string + ''' + stat = 0 +- if verbose or debug: print header+cmd ++ if verbose or debug: print(header+cmd) + # flush stdout so we don't mangle python's buffering + if not debug: + input, output = os.popen4(cmd) +- print output.read() ++ print(output.read()) + output.close() + input.close() + +diff --git a/pycontrib/graphicore/shell.py b/pycontrib/graphicore/shell.py +index 5d102f7..32fa584 100755 +--- a/pycontrib/graphicore/shell.py ++++ b/pycontrib/graphicore/shell.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # -*- coding: utf-8 -*- + """ + FontForge Interactive Python Shell +@@ -32,7 +32,7 @@ if len(sys.argv) == 0: + # some versions of IPython need content in sys.argv + sys.argv.append('') + +-from ipython_view import * ++from .ipython_view import * + import gdraw + + def runShell(data = None, glyphOrFont = None): +diff --git a/pycontrib/svg2sfd.py b/pycontrib/svg2sfd.py +index e1fc0ac..e23cb15 100644 +--- a/pycontrib/svg2sfd.py ++++ b/pycontrib/svg2sfd.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # + # Copyright 2013 Google Inc. All rights reserved. + # +@@ -49,7 +49,7 @@ def print_one_cmd(cmd, args): + result.append('%f' % (scale * args[i])) + result.append(cmd) + result.append('0') # TODO: should mark corner points +- print ' '.join(result) ++ print(' '.join(result)) + + def apply_rel_xy(xy, args): + x0, y0 = xy +@@ -75,7 +75,7 @@ def path_to_sfd(path): + for i in range(num_args_cmd(cmd)): + m = fre.match(path) + if m is None: +- print 'no float match:', path ++ print('no float match:', path) + args.append(float(m.group(1))) + path = path[m.end():] + #print cmd, args +@@ -128,13 +128,13 @@ def conv_svg(fn, char, glyphnum = None): + if glyphnum == None: + glyphnum = lastglyphnum + 1 + lastglyphnum = glyphnum +- print 'StartChar:', os.path.basename(fn)[:-4] +- print 'Encoding: %d %d %d' % (char, glyphnum, char) +- print 'Width: %d' % (21 * 40) +- print 'Flags: W' +- print 'LayerCount: 2' +- print 'Fore' +- print 'SplineSet' ++ print('StartChar:', os.path.basename(fn)[:-4]) ++ print('Encoding: %d %d %d' % (char, glyphnum, char)) ++ print('Width: %d' % (21 * 40)) ++ print('Flags: W') ++ print('LayerCount: 2') ++ print('Fore') ++ print('SplineSet') + doc = xml.dom.minidom.parse(fn) + # TODO: reverse paths if fill color is white-ish (this is more code, + # and in the meantime, we'll rely on correct path direction in FF) +@@ -147,16 +147,16 @@ def conv_svg(fn, char, glyphnum = None): + cy = float(circle.getAttribute('cy')) + r = float(circle.getAttribute('r')) + circle_to_sfd(cx, cy, r) +- print 'EndSplineSet' +- print 'EndChar' ++ print('EndSplineSet') ++ print('EndChar') + + def print_header(): + global header_printed +- print '''SplineFontDB: 3.0 ++ print('''SplineFontDB: 3.0 + FontName: %s + FullName: %s +-FamilyName: %s''' % (font_name, font_name, font_name) +- print '''Weight: Medium ++FamilyName: %s''' % (font_name, font_name, font_name)) ++ print('''Weight: Medium + Copyright: Copyright (C) 2011 Google Inc. + Version: 001.000 + UnderlinePosition: -120 +@@ -180,12 +180,12 @@ HheadAOffset: 0 + HheadDescent: 200 + HheadDOffset: 0 + BeginChars: 57600 57600 +-''' ++''') + header_printed = True + + def print_footer(): +- print '''EndChars +-EndSplineFont''' ++ print('''EndChars ++EndSplineFont''') + + def parse_int(x): + if x.startswith('0x'): +@@ -197,7 +197,7 @@ def run_file(fn): + global char_num + global font_name + directory = '' +- for l in file(fn).xreadlines(): ++ for l in file(fn): + if l.startswith('#'): + continue + s = l.strip().split() +diff --git a/pycontrib/webcollab.py b/pycontrib/webcollab.py +index 9ee0f17..4be07ec 100755 +--- a/pycontrib/webcollab.py ++++ b/pycontrib/webcollab.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # -*- coding: utf-8 -*- + """ + running web collab server hooks +@@ -44,8 +44,8 @@ def startWebServerInCollabMode(data = None, glyphOrFont = None): + global child + global childNodejs + ensureChildClosed() +- print("FONTFORGE:" + FONTFORGE) +- print("script path:" + collabpath + "web-test-collab.py") ++ print(("FONTFORGE:" + FONTFORGE)) ++ print(("script path:" + collabpath + "web-test-collab.py")) + child = subprocess.Popen( [ FONTFORGE, "-forceuihidden", "-script", collabpath + "web-test-collab.py" ] ) + # + # start the nodejs server +-- +2.9.3 + diff --git a/CVE-2020-25690-1.patch b/CVE-2020-25690-1.patch new file mode 100644 index 0000000000000000000000000000000000000000..51b5245037648eb8f440266e5eb323786a6413bc --- /dev/null +++ b/CVE-2020-25690-1.patch @@ -0,0 +1,78 @@ +From 048a91e2682c1a8936ae34dbc7bd70291ec05410 Mon Sep 17 00:00:00 2001 +From: Skef Iterum +Date: Mon, 6 Jan 2020 03:05:06 -0800 +Subject: [PATCH] Fix for #4084 Use-after-free (heap) in the + SFD_GetFontMetaData() function Fix for #4086 NULL pointer dereference in the + SFDGetSpiros() function Fix for #4088 NULL pointer dereference in the + SFD_AssignLookups() function Add empty sf->fontname string if it isn't set, + fixing #4089 #4090 and many other potential issues (many downstream calls + to strlen() on the value). + +--- + fontforge/sfd.c | 19 ++++++++++++++----- + fontforge/sfd1.c | 2 +- + 2 files changed, 15 insertions(+), 6 deletions(-) + +diff --git a/fontforge/sfd.c b/fontforge/sfd.c +index 731be201e0..e8ca39ba83 100644 +--- a/fontforge/sfd.c ++++ b/fontforge/sfd.c +@@ -4032,13 +4032,16 @@ static void SFDGetSpiros(FILE *sfd,SplineSet *cur) { + while ( fscanf(sfd,"%lg %lg %c", &cp.x, &cp.y, &cp.ty )==3 ) { + if ( cur!=NULL ) { + if ( cur->spiro_cnt>=cur->spiro_max ) +- cur->spiros = realloc(cur->spiros,(cur->spiro_max+=10)*sizeof(spiro_cp)); ++ cur->spiros = realloc(cur->spiros, ++ (cur->spiro_max+=10)*sizeof(spiro_cp)); + cur->spiros[cur->spiro_cnt++] = cp; + } + } +- if ( cur!=NULL && (cur->spiros[cur->spiro_cnt-1].ty&0x7f)!=SPIRO_END ) { ++ if ( cur!=NULL && cur->spiro_cnt>0 ++ && (cur->spiros[cur->spiro_cnt-1].ty&0x7f)!=SPIRO_END ) { + if ( cur->spiro_cnt>=cur->spiro_max ) +- cur->spiros = realloc(cur->spiros,(cur->spiro_max+=1)*sizeof(spiro_cp)); ++ cur->spiros = realloc(cur->spiros, ++ (cur->spiro_max+=1)*sizeof(spiro_cp)); + memset(&cur->spiros[cur->spiro_cnt],0,sizeof(spiro_cp)); + cur->spiros[cur->spiro_cnt++].ty = SPIRO_END; + } +@@ -7992,10 +7995,12 @@ bool SFD_GetFontMetaData( FILE *sfd, + else if ( strmatch(tok,"LayerCount:")==0 ) + { + d->had_layer_cnt = true; +- getint(sfd,&sf->layer_cnt); +- if ( sf->layer_cnt>2 ) { ++ int layer_cnt_tmp; ++ getint(sfd,&layer_cnt_tmp); ++ if ( layer_cnt_tmp>2 ) { + sf->layers = realloc(sf->layers,sf->layer_cnt*sizeof(LayerInfo)); + memset(sf->layers+2,0,(sf->layer_cnt-2)*sizeof(LayerInfo)); ++ sf->layer_cnt = layer_cnt_tmp; + } + } + else if ( strmatch(tok,"Layer:")==0 ) +@@ -8948,6 +8953,10 @@ exit( 1 ); + } + } + ++ // Many downstream functions assume this isn't NULL (use strlen, etc.) ++ if ( sf->fontname==NULL) ++ sf->fontname = copy(""); ++ + if ( fromdir ) + sf = SFD_FigureDirType(sf,tok,dirname,enc,remap,had_layer_cnt); + else if ( sf->subfontcnt!=0 ) { +diff --git a/fontforge/sfd1.c b/fontforge/sfd1.c +index cf931059d0..b42f832678 100644 +--- a/fontforge/sfd1.c ++++ b/fontforge/sfd1.c +@@ -674,7 +674,7 @@ void SFD_AssignLookups(SplineFont1 *sf) { + + /* Fix up some gunk from really old versions of the sfd format */ + SFDCleanupAnchorClasses(&sf->sf); +- if ( sf->sf.uni_interp==ui_unset ) ++ if ( sf->sf.uni_interp==ui_unset && sf->sf.map!=NULL ) + sf->sf.uni_interp = interp_from_encoding(sf->sf.map->enc,ui_none); + + /* Fixup for an old bug */ diff --git a/CVE-2020-25690-2.patch b/CVE-2020-25690-2.patch new file mode 100644 index 0000000000000000000000000000000000000000..c69bb487e1b5a89e953c02dff6bbc382499daf18 --- /dev/null +++ b/CVE-2020-25690-2.patch @@ -0,0 +1,28 @@ +From b96273acc691ac8a36c6a8dd4de8e6edd7eaae59 Mon Sep 17 00:00:00 2001 +From: Fredrick Brennan +Date: Tue, 21 Jan 2020 15:16:00 +0800 +Subject: [PATCH] Fix crash on exit introduced in previous commit + +When the number of layers is greater than 2, as in Chomsky.sfd and most +of my other fonts, FontForge will crash on exiting. + +This is just a simple mistake @skef made. +--- + fontforge/sfd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fontforge/sfd.c b/fontforge/sfd.c +index e8ca39ba83..9517d8cb12 100644 +--- a/fontforge/sfd.c ++++ b/fontforge/sfd.c +@@ -7998,9 +7998,9 @@ bool SFD_GetFontMetaData( FILE *sfd, + int layer_cnt_tmp; + getint(sfd,&layer_cnt_tmp); + if ( layer_cnt_tmp>2 ) { ++ sf->layer_cnt = layer_cnt_tmp; + sf->layers = realloc(sf->layers,sf->layer_cnt*sizeof(LayerInfo)); + memset(sf->layers+2,0,(sf->layer_cnt-2)*sizeof(LayerInfo)); +- sf->layer_cnt = layer_cnt_tmp; + } + } + else if ( strmatch(tok,"Layer:")==0 ) diff --git a/fontforge-20140813-use-system-uthash.patch b/fontforge-20140813-use-system-uthash.patch new file mode 100644 index 0000000000000000000000000000000000000000..e5a0b4b7db2853908e677ba3d245ad1fa086672f --- /dev/null +++ b/fontforge-20140813-use-system-uthash.patch @@ -0,0 +1,30 @@ +--- ./Makefile.am.old 2014-08-12 10:07:32.000000000 +0530 ++++ ./Makefile.am 2014-09-08 16:23:56.046996941 +0530 +@@ -43,7 +43,6 @@ + AM_CPPFLAGS = + AM_LDFLAGS = + +-BUILT_SOURCES = uthash/src + EXTRA_DIST = + CLEANFILES = + MOSTLYCLEANFILES = +@@ -113,7 +112,6 @@ + Packaging/FontForge-doc.spec \ + Packaging/FontForge.spec \ + Packaging/FontForge.static.spec \ +- uthash/src \ + $(NULL) + + #-------------------------------------------------------------------------- +@@ -129,11 +127,6 @@ + + + #-------------------------------------------------------------------------- +-uthash/src: +- if [ ! -e uthash/src ]; then \ +- if [ -e uthash ] ; then rm -r uthash ; fi ; \ +- git clone https://github.com/troydhanson/uthash ; \ +- fi ; + + # We import a selection of targets from Frank's standard packaging Makefile. + diff --git a/fontforge-20200314.tar.gz b/fontforge-20170731.tar.gz similarity index 59% rename from fontforge-20200314.tar.gz rename to fontforge-20170731.tar.gz index bf19d66db2ec81506092f584a0d7812fcf8c71eb..3a85ee1e51048fb33834753b2890507c36a45a47 100644 Binary files a/fontforge-20200314.tar.gz and b/fontforge-20170731.tar.gz differ diff --git a/fontforge-20200314-Call-gdk_set_allowed_backends-before-gdk_init.patch b/fontforge-20200314-Call-gdk_set_allowed_backends-before-gdk_init.patch deleted file mode 100644 index 6c1e797d266ea8a18de19253ddbc39d948a491a5..0000000000000000000000000000000000000000 --- a/fontforge-20200314-Call-gdk_set_allowed_backends-before-gdk_init.patch +++ /dev/null @@ -1,27 +0,0 @@ -From ee14a6389d19e2f45219134058e07f10585fa6d3 Mon Sep 17 00:00:00 2001 -From: Jeremy Tan -Date: Thu, 2 Apr 2020 18:03:47 +0800 -Subject: [PATCH] Call gdk_set_allowed_backends before gdk_init - -Fixes #4247 ---- - fontforgeexe/startui.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/fontforgeexe/startui.c b/fontforgeexe/startui.c -index 06f5200a4..114bb7fb6 100644 ---- a/fontforgeexe/startui.c -+++ b/fontforgeexe/startui.c -@@ -1182,8 +1182,8 @@ int fontforge_main( int argc, char **argv ) { - #endif - } - #ifdef FONTFORGE_CAN_USE_GDK -- gdk_init(&argc, &argv); - gdk_set_allowed_backends("win32,quartz,x11"); -+ gdk_init(&argc, &argv); - #endif - ensureDotFontForgeIsSetup(); - #if defined(__MINGW32__) && !defined(_NO_LIBCAIRO) --- -2.26.0 - diff --git a/fontforge-20200314-sphinx-make-changes-to-support-Sphinx-3.patch b/fontforge-20200314-sphinx-make-changes-to-support-Sphinx-3.patch deleted file mode 100644 index 886a161d0ad31dc1d0eadd6222984dbbedaf4307..0000000000000000000000000000000000000000 --- a/fontforge-20200314-sphinx-make-changes-to-support-Sphinx-3.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 36b52b9902a9e3858ef34ec006b6ad5da6374de1 Mon Sep 17 00:00:00 2001 -From: Jeremy Tan -Date: Mon, 6 Apr 2020 20:57:14 +1000 -Subject: [PATCH] sphinx: make changes to support Sphinx 3 - ---- - doc/sphinx/scripting/python/fontforge.rst | 18 +++--------------- - 1 file changed, 3 insertions(+), 15 deletions(-) - -diff --git a/doc/sphinx/scripting/python/fontforge.rst b/doc/sphinx/scripting/python/fontforge.rst -index b97332229..f726b1ed4 100644 ---- a/doc/sphinx/scripting/python/fontforge.rst -+++ b/doc/sphinx/scripting/python/fontforge.rst -@@ -1365,6 +1365,7 @@ Layers may be compared to see if their contours are similar. - layer.stroke("calligraphic", width, height, angle[, FLAGS]) - layer.stroke("polygon", contour[, FLAGS]) - (Legacy interface) -+ :noindex: - - .. method:: layer.stroke("circular", width [, CAP, JOIN, ANGLE, KEYWORD]) - layer.stroke("elliptical", width, minor_width [, ANGLE, CAP, JOIN, KEYWORD]) -@@ -2458,6 +2459,7 @@ must be created through the font. - glyph.stroke("calligraphic", width, height, angle[, FLAGS]) - glyph.stroke("polygon", contour[, FLAGS]) - (Legacy interface) -+ :noindex: - - .. method:: glyph.stroke("circular", width[, CAP, JOIN, ANGLE, KEYWORD]) - glyph.stroke("elliptical", width, minor_width[, ANGLE, CAP, JOIN, KEYWORD]) -@@ -4786,21 +4788,6 @@ See the :class:`selection` type for how to alter the selection. - Extrema should be marked by on-curve points. If a curve in any selected - glyph lacks a point at a significant extremum this command will add one. - --.. method:: font.addSmallCaps() -- -- For all selected upper or lower case letters in the latin, greek and -- cyrillic scripts this will try to create a small caps version of that glyph -- in a new glyph slot. -- -- So if you select "A" (or "a") then a glyph "a.sc" will be created (if "a.sc" -- already exists, it will be reused, and its current contents cleared). -- -- The contents of "a.sc" will be based on the upper case variant of this glyph -- (and that variant must be present for the command to work). FontForge will -- also create two lookups (unless appropriate ones already exist) one, bound -- to the feature 'c2sc' will map upper case letters to small caps, the other, -- bound to feature 'smcp' will map lower case letters to small caps. -- - .. method:: font.autoHint() - - Generates PostScript hints for all selected glyphs. -@@ -4993,6 +4980,7 @@ See the :class:`selection` type for how to alter the selection. - font.stroke("calligraphic", width, height, angle[, FLAGS]) - font.stroke("polygon", contour[, FLAGS]) - (Legacy interface) -+ :noindex: - - .. method:: font.stroke("circular", width[, CAP, JOIN, ANGLE, KEYWORD]) - font.stroke("elliptical", width, minor_width[, ANGLE, CAP, JOIN, KEYWORD]) --- -2.26.0 - diff --git a/fontforge.spec b/fontforge.spec index 441aa740acaa546f80e22aa611842d50e6e3f246..e6a73430e4765efd450b77503560ae61f1626d77 100644 --- a/fontforge.spec +++ b/fontforge.spec @@ -1,119 +1,112 @@ -%global gettext_package FontForge -%global gittag0 20200314 - Name: fontforge -Version: 20200314 -Release: 1 +Version: 20170731 +Release: 14 Summary: Outline and bitmap font editor + License: GPLv3+ URL: http://fontforge.github.io/ -Source0: https://github.com/fontforge/%{name}/archive/%{gittag0}.tar.gz#/%{name}-%{version}.tar.gz +Source0: https://github.com/fontforge/fontforge/archive/20170731.tar.gz#/fontforge-%{version}.tar.gz +Source1: http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=snapshot;h=b324052;sf=tgz;name=gnulib-b324052.tar.gz +Patch0000: fontforge-20140813-use-system-uthash.patch +Patch0001: Add-python3-support.patch +Patch0002: CVE-2020-25690-1.patch +Patch0003: CVE-2020-25690-2.patch + +Requires: xdg-utils hicolor-icon-theme -Patch0001: fontforge-20200314-Call-gdk_set_allowed_backends-before-gdk_init.patch -Patch0002: fontforge-20200314-sphinx-make-changes-to-support-Sphinx-3.patch +BuildRequires: gcc git libjpeg-devel libtiff-devel libpng-devel giflib-devel libxml2-devel freetype-devel +BuildRequires: desktop-file-utils libXt-devel libXi-devel xorg-x11-proto-devel gettext pango-devel cairo-devel +BuildRequires: python3-devel gnulib-devel libtool-ltdl-devel readline-devel uthash-devel shared-mime-info -Requires: xdg-utils autotrace hicolor-icon-theme -BuildRequires: gcc-c++ cmake libjpeg-devel libtiff-devel libpng-devel giflib-devel libxml2-devel -BuildRequires: freetype-devel desktop-file-utils libuninameslist-devel libXt-devel xorg-x11-proto-devel -BuildRequires: gettext pango-devel cairo-devel libspiro-devel python3-devel readline-devel -BuildRequires: libappstream-glib woff2-devel shared-mime-info gtk3-devel python3-sphinx +Provides: bundled(gnulib) %description -FontForge (former PfaEdit) is a font editor for outline and bitmap -fonts. It supports a range of font formats, including PostScript -(ASCII and binary Type 1, some Type 3 and Type 0), TrueType, OpenType -(Type2) and CID-keyed fonts. - -%package devel -Summary: Development files for fontforge -Requires: %{name} = %{version}-%{release} -Requires: %{name}-help = %{version}-%{release} -Requires: pkgconfig - -%description devel -This package includes the library files you will need to compile -applications against fontforge. - -%package help -Summary: Documentation files for %{name} -BuildArch: noarch -Provides: %{name}-doc = %{version}-%{release} -Obsoletes: %{name}-doc < %{version}-%{release} - -%description help -This package contains documentation files for %{name}. +FontForge is designed for editing outline and bitmap fonts in various formats, such as PostScript (ASCII and +binary Type 1, some Type 3 and Type 0), TrueType, OpenType (Type2) and CID-keyed fonts. -%prep -%autosetup -n %{name}-%{version} -p1 +%package devel +Summary: Development tools for fontforge +Requires: fontforge = %{version}-%{release} fontforge-help = %{version}-%{release} pkgconfig + +%description devel +This package includes the libraries and header files for developing applications against fontforge. + +%package help +Summary: Documentation files for fontforge +BuildArch: noarch -# Remove tests that requires Internet access -sed -i '45d;83d;101d;102d;114d;115d;125d' tests/CMakeLists.txt -rm tests/test003.pe tests/test130.pe tests/test0101.py tests/test929.py -# Remove tests for s390x -rm tests/test0004.py tests/test1009.py tests/test1010.py +Provides: fontforge-doc = %{version}-%{release} +Obsoletes: fontforge-doc < %{version}-%{release} + +%description help +This package contains documentation files for fontforge. + + +%prep +%autosetup -p1 +tar xzf %{SOURCE1} +sed -i -e '/^#!\//, 1d' pycontrib/webcollab.py +mkdir htdocs +cp -pr doc/html/* htdocs +%{__sed} -i 's/\r//' htdocs/Big5.txt +%{__sed} -i 's/\r//' htdocs/corpchar.txt %build -rm -rf build && mkdir build -pushd build +./bootstrap --skip-git --gnulib-srcdir=gnulib-b324052 export CFLAGS="%{optflags} -fno-strict-aliasing" -%cmake .. -DCMAKE_BUILD_TYPE=Release \ - -DENABLE_WOFF2=ON \ - -DENABLE_DOCS=NO - -%{make_build} -popd +%configure PYTHON=python3 --without-libspiro --without-libuninameslist +%make_build V=1 %install -pushd build -%{make_install} -popd +%make_install +rm -f $RPM_BUILD_ROOT%{_libdir}/libgdraw.la +rm -f $RPM_BUILD_ROOT%{_libdir}/libgunicode.la +rm -f $RPM_BUILD_ROOT%{_libdir}/libgdraw.so +rm -f $RPM_BUILD_ROOT%{_libdir}/libgunicode.so + +desktop-file-install --dir $RPM_BUILD_ROOT%{_datadir}/applications \ + desktop/fontforge.desktop -desktop-file-install \ - --dir $RPM_BUILD_ROOT%{_datadir}/applications \ - --add-category X-Fedora \ - desktop/org.fontforge.FontForge.desktop +%delete_la_and_a -# remove unneeded .la and .a files -find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' -find $RPM_BUILD_ROOT -name '*.a' -exec rm -f {} ';' +%find_lang FontForge -rm -f %{buildroot}%{_datadir}/doc/fontforge/{.buildinfo,.nojekyll} -appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.appdata.xml +install -d $RPM_BUILD_ROOT%{_datadir}/appdata +install -pm 644 desktop/fontforge.appdata.xml $RPM_BUILD_ROOT%{_datadir}/appdata -# Find translations -%find_lang %{gettext_package} +install -d $RPM_BUILD_ROOT%{_datadir}/mime/packages +install -pm 644 desktop/fontforge.xml $RPM_BUILD_ROOT%{_datadir}/mime/packages/ -%check -pushd build -make check -popd +chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/python/gdraw/_gdraw.py -%files -f %{gettext_package}.lang +%files -f FontForge.lang %doc AUTHORS -%license LICENSE COPYING.gplv3 +%license LICENSE %{_bindir}/* %{_libdir}/lib*.so.* -%{_datadir}/applications/*FontForge.desktop +%{_datadir}/applications/*fontforge.desktop %{_datadir}/fontforge -%{_datadir}/icons/hicolor/*/apps/org.fontforge.FontForge* -%{_datadir}/pixmaps/org.fontforge.FontForge* -%{_datadir}/mime/packages/fontforge.xml -%{_metainfodir}/org.fontforge.FontForge.appdata.xml +%{_datadir}/icons/* +%{_datadir}/mime/* +%{_datadir}/appdata/* %{python3_sitearch}/fontforge.so %{python3_sitearch}/psMat.so +%exclude %{_datadir}/doc/fontforge -%files devel +%files devel +%{_includedir}/fontforge/ %{_libdir}/lib*.so +%{_libdir}/pkgconfig/*.pc -%files help -%doc %{_pkgdocdir} +%files help +%doc htdocs %{_mandir}/man1/*.1* %changelog -* Wed Aug 26 2020 jinzhimin - 20200314-1 -- upgrade to 20200314 +* Fri Mar 26 2021 guoxiaoqi - 20170731-14 +- fix CVE-2020-25690 * Tue Aug 18 2020 senlin - 20170731-13 - add release for update diff --git a/gnulib-b324052.tar.gz b/gnulib-b324052.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..0b9319a2622474a4c5e6cc2d2a861e2399ed6e17 Binary files /dev/null and b/gnulib-b324052.tar.gz differ