From 00599859f74ed53a72ee4925a3836852e65264f2 Mon Sep 17 00:00:00 2001 From: Parag Nemade Date: Wed, 25 Mar 2020 21:29:11 +0530 Subject: [PATCH] Update to 20200314 version (#1813578) --- .gitignore | 1 + ...forge-20190413-python-3.8-pkg-config.patch | 14 --- ...-20190801-cve-2020-5395-followup-fix.patch | 28 ------ fontforge-20190801-cve-2020-5395.patch | 78 --------------- ...forge-20190801-fix-metainfo.xml-file.patch | 41 -------- fontforge.spec | 98 ++++++++----------- sources | 2 +- tests/scripts/generate-font.py | 14 +++ tests/scripts/generate-sfd.pe | 7 ++ .../scripts/{generate.pe => generate-ttf.pe} | 0 tests/scripts/run_tests.sh | 23 ++++- 11 files changed, 83 insertions(+), 223 deletions(-) delete mode 100644 fontforge-20190413-python-3.8-pkg-config.patch delete mode 100644 fontforge-20190801-cve-2020-5395-followup-fix.patch delete mode 100644 fontforge-20190801-cve-2020-5395.patch delete mode 100644 fontforge-20190801-fix-metainfo.xml-file.patch create mode 100644 tests/scripts/generate-font.py create mode 100755 tests/scripts/generate-sfd.pe rename tests/scripts/{generate.pe => generate-ttf.pe} (100%) diff --git a/.gitignore b/.gitignore index 749cac3..245b9b3 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ fontforge_full-20100501.tar.bz2 /gnulib-b324052.tar.gz /fontforge-20190317.tar.gz /fontforge-20190413.tar.gz +/fontforge-20200314.tar.gz diff --git a/fontforge-20190413-python-3.8-pkg-config.patch b/fontforge-20190413-python-3.8-pkg-config.patch deleted file mode 100644 index 485f796..0000000 --- a/fontforge-20190413-python-3.8-pkg-config.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -urN fontforge-20190413.old/m4/fontforge_arg_enable.m4 fontforge-20190413/m4/fontforge_arg_enable.m4 ---- fontforge-20190413.old/m4/fontforge_arg_enable.m4 2019-04-13 13:08:39.000000000 +0530 -+++ fontforge-20190413/m4/fontforge_arg_enable.m4 2019-07-21 16:31:27.939734401 +0530 -@@ -116,8 +116,8 @@ - if test x"${i_do_have_python_scripting}" != xyes; then - i_want_python_ver= - else -- PKG_CHECK_MODULES([PYTHON],[python-"${PYTHON_VERSION}"], dnl [PKG_CHECK_MODULES([PYTHONDEV],[python-"${PYTHON_VERSION}"],,[i_do_have_python_scripting=maybe])], -- [PKG_CHECK_MODULES([PYTHONDEV],[python-"${PYTHON_VERSION}"],,[i_do_have_python_scripting=no])], -+ PKG_CHECK_MODULES([PYTHON],[python-"${PYTHON_VERSION}"-embed], dnl [PKG_CHECK_MODULES([PYTHONDEV],[python-"${PYTHON_VERSION}"-embed],,[i_do_have_python_scripting=maybe])], -+ [PKG_CHECK_MODULES([PYTHONDEV],[python-"${PYTHON_VERSION}"-embed],,[i_do_have_python_scripting=no])], - [i_do_have_python_scripting=no]) - dnl dnl TODO: have python3 AND python2, but only have python2 dev, but no python3 dev - dnl if test x"${i_do_have_python_scripting}" = xmaybe; then diff --git a/fontforge-20190801-cve-2020-5395-followup-fix.patch b/fontforge-20190801-cve-2020-5395-followup-fix.patch deleted file mode 100644 index c69bb48..0000000 --- a/fontforge-20190801-cve-2020-5395-followup-fix.patch +++ /dev/null @@ -1,28 +0,0 @@ -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-20190801-cve-2020-5395.patch b/fontforge-20190801-cve-2020-5395.patch deleted file mode 100644 index 51b5245..0000000 --- a/fontforge-20190801-cve-2020-5395.patch +++ /dev/null @@ -1,78 +0,0 @@ -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/fontforge-20190801-fix-metainfo.xml-file.patch b/fontforge-20190801-fix-metainfo.xml-file.patch deleted file mode 100644 index 471ee7d..0000000 --- a/fontforge-20190801-fix-metainfo.xml-file.patch +++ /dev/null @@ -1,41 +0,0 @@ -From b26f33f178d1049070537166e3fac08b690de4d1 Mon Sep 17 00:00:00 2001 -From: muelli -Date: Tue, 6 Aug 2019 12:58:30 +0200 -Subject: [PATCH] appdata: remove spaces to comply with xml syntax - -The attribute had an illegal whitespace. appstream-glib validate complained: - -org.fontforge.FontForge.metainfo.xml: failed to parse org.fontforge.FontForge.metainfo.xml: Error on line 56 char 15: Odd character ?l?, expected a ?=? after attribute name ?xml:? of element ?p? - - -Now it does not complain about the syntax anymore, but instead about the description: -org.fontforge.FontForge.metainfo.xml: FAILED: -? style-invalid : Not enough

tags for a good description [0/1] -Validation of files failed ---- - desktop/org.fontforge.FontForge.metainfo.xml | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/desktop/org.fontforge.FontForge.metainfo.xml b/desktop/org.fontforge.FontForge.metainfo.xml -index 1ff9ea03e..3583e6da2 100644 ---- a/desktop/org.fontforge.FontForge.metainfo.xml -+++ b/desktop/org.fontforge.FontForge.metainfo.xml -@@ -49,15 +49,15 @@ -

- Apprendre à utiliser FontForge est facile, et il y a plusieurs tutoriels disponibles en commençant - par les bases jusqu'à des fonctionnalités plus avancées telles que la fabrication et l'utilisation de scripts.

--

-+

- FontForge je program za uređivanje konturnih i bitmap fontova. Omogućuje stvaranje, - uređivanje ili konvertiranje raznih vrsta fontova, uključujući PostScript, TrueType, - OpenType, CID, multiple-master, CFF, SVG i BitMap (bdf, FON, NFNT) fontove.

--

-+

- FontForge je slobodan softver otvorenog kȏda te je izrađen za razne operacijske - sustave. FontForge se može koristiti u grafičkom načinu rada ili putem naredbenog - retka.

--

-+

- FontForge je lako naučiti. Na raspolaganju stoje različiti priručnici – od osnovnih - vježbi, sve do naprednijih funkcija, kao što su izrada i upotreba skriptova.

-

diff --git a/fontforge.spec b/fontforge.spec index ae7a262..6e396fa 100644 --- a/fontforge.spec +++ b/fontforge.spec @@ -1,28 +1,21 @@ %global gettext_package FontForge -%global gittag0 20190801 +%global gittag0 20200314 Name: fontforge -Version: 20190801 -Release: 6%{?dist} +Version: 20200314 +Release: 1%{?dist} 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 -Patch0: fontforge-20190413-python-3.8-pkg-config.patch -# Below are upstream patches -Patch1: fontforge-20190801-fix-metainfo.xml-file.patch -# https://github.com/fontforge/fontforge/issues/4084 -Patch2: fontforge-20190801-cve-2020-5395.patch -# https://github.com/fontforge/fontforge/issues/4164 -Patch3: fontforge-20190801-cve-2020-5395-followup-fix.patch Requires: xdg-utils Requires: autotrace Requires: hicolor-icon-theme -BuildRequires: gcc -BuildRequires: git +BuildRequires: gcc-c++ +BuildRequires: cmake BuildRequires: libjpeg-devel BuildRequires: libtiff-devel BuildRequires: libpng-devel @@ -31,23 +24,18 @@ BuildRequires: libxml2-devel BuildRequires: freetype-devel BuildRequires: desktop-file-utils BuildRequires: libuninameslist-devel -BuildRequires: libXt-devel -BuildRequires: xorg-x11-proto-devel BuildRequires: gettext BuildRequires: pango-devel BuildRequires: cairo-devel BuildRequires: libspiro-devel BuildRequires: python3-devel -BuildRequires: gnulib-devel -BuildRequires: libtool-ltdl-devel BuildRequires: readline-devel BuildRequires: libappstream-glib -# This is failing on aarch64 so drop it -#BuildRequires: python-ipython # F25 build is failing add following to fix BuildRequires: shared-mime-info -# F30 onward need now -BuildRequires: /usr/bin/pathfix.py +# F33 onward need now +BuildRequires: gtk3-devel +BuildRequires: python3-sphinx %description FontForge (former PfaEdit) is a font editor for outline and bitmap @@ -56,14 +44,13 @@ fonts. It supports a range of font formats, including PostScript (Type2) and CID-keyed fonts. %package devel -Summary: Development tools for fontforge -Requires: %{name} = %{version}-%{release} +Summary: Development files for fontforge +Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}-doc = %{version}-%{release} -Requires: pkgconfig %description devel -This package includes the libraries and header files you will need -to compile applications against fontforge. +This package includes the library files you will need to compile +applications against fontforge. %package doc Summary: Documentation files for %{name} @@ -75,53 +62,45 @@ This package contains documentation files for %{name}. %prep %setup -q -%if 0%{?python3_version_nodots} >= 38 -%patch0 -p1 -%endif -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 - -mkdir htdocs -cp -pr doc/html/* htdocs -chmod 644 htdocs/nonBMP/index.html -# Fix bad line terminators -%{__sed} -i 's/\r//' htdocs/Big5.txt -%{__sed} -i 's/\r//' htdocs/corpchar.txt +# 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 %build -./bootstrap --skip-git +rm -rf build && mkdir build +pushd build export CFLAGS="%{optflags} -fno-strict-aliasing" -%configure PYTHON=python3 -make V=1 %{?_smp_mflags} +%cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} +%{make_build} +popd %install -make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" -rm -f $RPM_BUILD_ROOT%{_libdir}/libg{draw,unicode}.{la,so} +pushd build +%{make_install} +popd + desktop-file-install \ --dir $RPM_BUILD_ROOT%{_datadir}/applications \ --add-category X-Fedora \ desktop/org.fontforge.FontForge.desktop -# Let's remove the appdata file as it does not contain translation -# and tag. -rm -f %{buildroot}%{_datadir}/appdata/*.appdata.xml -rm -f %{buildroot}%{_metainfodir}/*.appdata.xml - -appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.metainfo.xml - -# The fontforge makefiles install htdocs as well, but we -# prefer to have them under the standard RPM location, so -# remove the extra copy -rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/fontforge - # remove unneeded .la and .a files find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' find $RPM_BUILD_ROOT -name '*.a' -exec rm -f {} ';' +rm -f %{buildroot}%{_datadir}/doc/fontforge/{.buildinfo,.nojekyll} +appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.appdata.xml + +%check +pushd build +make check +popd + # Find translations %find_lang %{gettext_package} @@ -136,19 +115,20 @@ find $RPM_BUILD_ROOT -name '*.a' -exec rm -f {} ';' %{_mandir}/man1/*.1* %{_datadir}/pixmaps/org.fontforge.FontForge* %{_datadir}/mime/packages/fontforge.xml -%{_metainfodir}/org.fontforge.FontForge.metainfo.xml +%{_metainfodir}/org.fontforge.FontForge.appdata.xml %{python3_sitearch}/fontforge.so %{python3_sitearch}/psMat.so %files devel -%{_includedir}/fontforge/ %{_libdir}/lib*.so -%{_libdir}/pkgconfig/*.pc %files doc -%doc htdocs +%doc %{_pkgdocdir} %changelog +* Wed Mar 25 2020 Parag Nemade - 20200314-1 +- Update to 20200314 version (#1813578) + * Sun Feb 16 2020 Parag Nemade - 20190801-6 - another fix for rh#1790042 - CVE-2020-5395:out-of-bounds write in sfd.c diff --git a/sources b/sources index 60439ae..1bfbb03 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (fontforge-20190801.tar.gz) = d60fc69f9c692dd85e89e9c336dc5f141254f4472b02586145dd00b8f3d0b7608f229e3f642db2a03a42c4b543a0557286d0b617ddc3a1080e2c1791d4ea83d5 +SHA512 (fontforge-20200314.tar.gz) = 9eecee6162d5d160c9fe5d3e229763edb0b52f53529659f0fa8b41cf3edf0685509f51d3993da0e6e2c36fecde867af60062e131e10d7fdfbaac16323855818f diff --git a/tests/scripts/generate-font.py b/tests/scripts/generate-font.py new file mode 100644 index 0000000..633001f --- /dev/null +++ b/tests/scripts/generate-font.py @@ -0,0 +1,14 @@ +import fontforge +import os + +myFont = fontforge.open("Cantarell-Regular.ttf") +myFont.generate("Cantarell-Regular.sfd") +myFont.close() + +myFont = fontforge.open("Cantarell-Regular.sfd") +myFont.generate("Cantarell-Regular.ttf") +myFont.close() + +os.remove("Cantarell-Regular.ttf") +os.remove("Cantarell-Regular.sfd") + diff --git a/tests/scripts/generate-sfd.pe b/tests/scripts/generate-sfd.pe new file mode 100755 index 0000000..4877fc8 --- /dev/null +++ b/tests/scripts/generate-sfd.pe @@ -0,0 +1,7 @@ +#!/usr/bin/fontforge +i=1 +Open($argv[i], 1) +#Use gen_flags=Defualt fmflags value as -1 +gen_flags = -1 +Generate("" + $fontname + ".sfd", "", gen_flags) + diff --git a/tests/scripts/generate.pe b/tests/scripts/generate-ttf.pe similarity index 100% rename from tests/scripts/generate.pe rename to tests/scripts/generate-ttf.pe diff --git a/tests/scripts/run_tests.sh b/tests/scripts/run_tests.sh index 83aebe3..389d6f5 100644 --- a/tests/scripts/run_tests.sh +++ b/tests/scripts/run_tests.sh @@ -1,4 +1,23 @@ #!/bin/bash -/usr/bin/fontforge -script generate.pe /usr/share/fontforge/python/test.sfd -/usr/bin/python3 get-font-metadata.py ./Untitled1.ttf +cp /usr/share/fontforge/pixmaps/Cantarell-Regular.ttf . + +echo "----------------------------------------------------------" +echo "Executing get-font-metadata.py on Cantarell-Regular.ttf =>" +/usr/bin/python3 get-font-metadata.py ./Cantarell-Regular.ttf + +echo "----------------------------------------------------------" +echo "Executing generate-font.py on Cantarell-Regular.ttf =>" +/usr/bin/python3 generate-font.py ./Cantarell-Regular.ttf + +echo "----------------------------------------------------------" +cp /usr/share/fontforge/pixmaps/Cantarell-Regular.ttf . +echo "Executing generate-sfd.pe on Cantarell-Regular.ttf =>" +/usr/bin/fontforge -script generate-sfd.pe ./Cantarell-Regular.ttf +rm Cantarell-Regular.ttf + +echo "----------------------------------------------------------" +echo "Executing generate-ttf.pe on Cantarell-Regular.sfd =>" +/usr/bin/fontforge -script generate-ttf.pe ./Cantarell-Regular.sfd +echo "----------------------------------------------------------" +