Update to 20200314 version (#1813578)

This commit is contained in:
Parag Nemade 2020-03-25 21:29:11 +05:30
parent 7f6f786c73
commit 00599859f7
No known key found for this signature in database
GPG Key ID: 71932951EB71E972
11 changed files with 83 additions and 223 deletions

1
.gitignore vendored
View File

@ -21,3 +21,4 @@ fontforge_full-20100501.tar.bz2
/gnulib-b324052.tar.gz /gnulib-b324052.tar.gz
/fontforge-20190317.tar.gz /fontforge-20190317.tar.gz
/fontforge-20190413.tar.gz /fontforge-20190413.tar.gz
/fontforge-20200314.tar.gz

View File

@ -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

View File

@ -1,28 +0,0 @@
From b96273acc691ac8a36c6a8dd4de8e6edd7eaae59 Mon Sep 17 00:00:00 2001
From: Fredrick Brennan <copypaste@kittens.ph>
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 )

View File

@ -1,78 +0,0 @@
From 048a91e2682c1a8936ae34dbc7bd70291ec05410 Mon Sep 17 00:00:00 2001
From: Skef Iterum <unknown>
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 */

View File

@ -1,41 +0,0 @@
From b26f33f178d1049070537166e3fac08b690de4d1 Mon Sep 17 00:00:00 2001
From: muelli <muelli@cryptobitch.de>
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 <p> 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 @@
<p xml:lang="fr">
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.</p>
- <p xml: lang = "hr">
+ <p xml:lang = "hr">
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.</p>
- <p xml: lang = "hr">
+ <p xml:lang = "hr">
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.</p>
- <p xml: lang = "hr">
+ <p xml:lang = "hr">
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.</p>
<p xml:lang="uk">

View File

@ -1,28 +1,21 @@
%global gettext_package FontForge %global gettext_package FontForge
%global gittag0 20190801 %global gittag0 20200314
Name: fontforge Name: fontforge
Version: 20190801 Version: 20200314
Release: 6%{?dist} Release: 1%{?dist}
Summary: Outline and bitmap font editor Summary: Outline and bitmap font editor
License: GPLv3+ License: GPLv3+
URL: http://fontforge.github.io/ URL: http://fontforge.github.io/
Source0: https://github.com/fontforge/%{name}/archive/%{gittag0}.tar.gz#/%{name}-%{version}.tar.gz 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: xdg-utils
Requires: autotrace Requires: autotrace
Requires: hicolor-icon-theme Requires: hicolor-icon-theme
BuildRequires: gcc BuildRequires: gcc-c++
BuildRequires: git BuildRequires: cmake
BuildRequires: libjpeg-devel BuildRequires: libjpeg-devel
BuildRequires: libtiff-devel BuildRequires: libtiff-devel
BuildRequires: libpng-devel BuildRequires: libpng-devel
@ -31,23 +24,18 @@ BuildRequires: libxml2-devel
BuildRequires: freetype-devel BuildRequires: freetype-devel
BuildRequires: desktop-file-utils BuildRequires: desktop-file-utils
BuildRequires: libuninameslist-devel BuildRequires: libuninameslist-devel
BuildRequires: libXt-devel
BuildRequires: xorg-x11-proto-devel
BuildRequires: gettext BuildRequires: gettext
BuildRequires: pango-devel BuildRequires: pango-devel
BuildRequires: cairo-devel BuildRequires: cairo-devel
BuildRequires: libspiro-devel BuildRequires: libspiro-devel
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: gnulib-devel
BuildRequires: libtool-ltdl-devel
BuildRequires: readline-devel BuildRequires: readline-devel
BuildRequires: libappstream-glib BuildRequires: libappstream-glib
# This is failing on aarch64 so drop it
#BuildRequires: python-ipython
# F25 build is failing add following to fix # F25 build is failing add following to fix
BuildRequires: shared-mime-info BuildRequires: shared-mime-info
# F30 onward need now # F33 onward need now
BuildRequires: /usr/bin/pathfix.py BuildRequires: gtk3-devel
BuildRequires: python3-sphinx
%description %description
FontForge (former PfaEdit) is a font editor for outline and bitmap 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. (Type2) and CID-keyed fonts.
%package devel %package devel
Summary: Development tools for fontforge Summary: Development files for fontforge
Requires: %{name} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-doc = %{version}-%{release} Requires: %{name}-doc = %{version}-%{release}
Requires: pkgconfig
%description devel %description devel
This package includes the libraries and header files you will need This package includes the library files you will need to compile
to compile applications against fontforge. applications against fontforge.
%package doc %package doc
Summary: Documentation files for %{name} Summary: Documentation files for %{name}
@ -75,53 +62,45 @@ This package contains documentation files for %{name}.
%prep %prep
%setup -q %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 %build
./bootstrap --skip-git rm -rf build && mkdir build
pushd build
export CFLAGS="%{optflags} -fno-strict-aliasing" export CFLAGS="%{optflags} -fno-strict-aliasing"
%configure PYTHON=python3 %cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix}
make V=1 %{?_smp_mflags} %{make_build}
popd
%install %install
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" pushd build
rm -f $RPM_BUILD_ROOT%{_libdir}/libg{draw,unicode}.{la,so} %{make_install}
popd
desktop-file-install \ desktop-file-install \
--dir $RPM_BUILD_ROOT%{_datadir}/applications \ --dir $RPM_BUILD_ROOT%{_datadir}/applications \
--add-category X-Fedora \ --add-category X-Fedora \
desktop/org.fontforge.FontForge.desktop desktop/org.fontforge.FontForge.desktop
# Let's remove the appdata file as it does not contain translation
# and <name> 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 # remove unneeded .la and .a files
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
find $RPM_BUILD_ROOT -name '*.a' -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 translations
%find_lang %{gettext_package} %find_lang %{gettext_package}
@ -136,19 +115,20 @@ find $RPM_BUILD_ROOT -name '*.a' -exec rm -f {} ';'
%{_mandir}/man1/*.1* %{_mandir}/man1/*.1*
%{_datadir}/pixmaps/org.fontforge.FontForge* %{_datadir}/pixmaps/org.fontforge.FontForge*
%{_datadir}/mime/packages/fontforge.xml %{_datadir}/mime/packages/fontforge.xml
%{_metainfodir}/org.fontforge.FontForge.metainfo.xml %{_metainfodir}/org.fontforge.FontForge.appdata.xml
%{python3_sitearch}/fontforge.so %{python3_sitearch}/fontforge.so
%{python3_sitearch}/psMat.so %{python3_sitearch}/psMat.so
%files devel %files devel
%{_includedir}/fontforge/
%{_libdir}/lib*.so %{_libdir}/lib*.so
%{_libdir}/pkgconfig/*.pc
%files doc %files doc
%doc htdocs %doc %{_pkgdocdir}
%changelog %changelog
* Wed Mar 25 2020 Parag Nemade <pnemade AT redhat DOT com> - 20200314-1
- Update to 20200314 version (#1813578)
* Sun Feb 16 2020 Parag Nemade <pnemade AT redhat DOT com> - 20190801-6 * Sun Feb 16 2020 Parag Nemade <pnemade AT redhat DOT com> - 20190801-6
- another fix for rh#1790042 - CVE-2020-5395:out-of-bounds write in sfd.c - another fix for rh#1790042 - CVE-2020-5395:out-of-bounds write in sfd.c

View File

@ -1 +1 @@
SHA512 (fontforge-20190801.tar.gz) = d60fc69f9c692dd85e89e9c336dc5f141254f4472b02586145dd00b8f3d0b7608f229e3f642db2a03a42c4b543a0557286d0b617ddc3a1080e2c1791d4ea83d5 SHA512 (fontforge-20200314.tar.gz) = 9eecee6162d5d160c9fe5d3e229763edb0b52f53529659f0fa8b41cf3edf0685509f51d3993da0e6e2c36fecde867af60062e131e10d7fdfbaac16323855818f

View File

@ -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")

7
tests/scripts/generate-sfd.pe Executable file
View File

@ -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)

View File

@ -1,4 +1,23 @@
#!/bin/bash #!/bin/bash
/usr/bin/fontforge -script generate.pe /usr/share/fontforge/python/test.sfd cp /usr/share/fontforge/pixmaps/Cantarell-Regular.ttf .
/usr/bin/python3 get-font-metadata.py ./Untitled1.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 "----------------------------------------------------------"