Sync from SUSE:SLFO:Main fontforge revision 08600376462e0a1b345f2c4d7e6a8ef0

This commit is contained in:
Adrian Schröter 2024-06-12 22:29:59 +02:00
parent 15121af8a8
commit d234d38d1b
5 changed files with 9006 additions and 156 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,146 +0,0 @@
Index: fontforge-20200314/doc/sphinx/techref/splinefont.rst
===================================================================
--- fontforge-20200314.orig/doc/sphinx/techref/splinefont.rst
+++ fontforge-20200314/doc/sphinx/techref/splinefont.rst
@@ -195,7 +195,7 @@ The bounding box of a :ref:`Spline <spli
:ref:`SplineChar <splinefont.SplineChar>`, :ref:`RefChar <splinefont.RefChar>`,
:ref:`Image <splinefont.ImageList>`, or whatever else needs a bounding box.
-.. code-block::
+.. code-block:: cpp
:name: splinefont.BDFFloat
typedef struct bdffloat {
@@ -206,7 +206,7 @@ The bounding box of a :ref:`Spline <spli
The floating selection in a :ref:`BDFChar <splinefont.BDFChar>`.
-.. code-block::
+.. code-block:: cpp
:name: splinefont.Undoes
typedef struct undoes {
@@ -277,7 +277,7 @@ both the splines and the bitmaps of a ch
ut_mult is used when doing a copy from the FontView where you are copying more
than one character.
-.. code-block::
+.. code-block:: cpp
:name: splinefont.BDFChar
typedef struct bdfchar {
@@ -318,7 +318,7 @@ represented by a byte rather than a bit.
The last thing in the BDFChar is a (/an optional) floating selection. Only
present if the user has made a selection or done a paste or something like that.
-.. code-block::
+.. code-block:: cpp
:name: splinefont.BDFFont
typedef struct bdffont {
@@ -345,7 +345,7 @@ contains a count of the number of entrie
itself. Currently the number of entries here is always 16, but that could
change.
-.. code-block::
+.. code-block:: cpp
:name: splinefont.SplinePoint
enum pointtype { pt_curve, pt_corner, pt_tangent };
@@ -405,7 +405,7 @@ drawing it. They are cached so they don'
There's a different set of lines for every scale (as there is a different amount
of visible detail). They get freed and regenerated if the Spline changes.
-.. code-block::
+.. code-block:: cpp
:name: splinefont.Spline
typedef struct spline1d {
@@ -439,7 +439,7 @@ some are used in other places too.
The Spline1D structures give the equations for the x and y coordinates
respectively (splines[0] is for x, splines[1] is for y).
-.. code-block::
+.. code-block:: cpp
:name: splinefont.SplinePointList
typedef struct splinepointlist {
@@ -463,7 +463,7 @@ to). A SplinePointList is a connected pa
Generally a series of paths will make up a character, and they are linked
together on the next field.
-.. code-block::
+.. code-block:: cpp
:name: splinefont.RefChar
typedef struct refchar {
@@ -498,7 +498,7 @@ themselves). The selected field indicate
field provides a transformed bounding box. And the sc field points to the
SplineChar we are referring to.
-.. code-block::
+.. code-block:: cpp
:name: splinefont.KernPair
typedef struct kernpair {
@@ -514,7 +514,7 @@ offset between them (or rather the diffe
and right bearings would lead you to believe it should be). Next points to the
next kernpair.
-.. code-block::
+.. code-block:: cpp
:name: splinefont.Hints
typedef struct hints {
@@ -532,7 +532,7 @@ y space) of where the stem starts, and w
negative (in which case base is where the stem ends). Next points to the next
hint for the character.
-.. code-block::
+.. code-block:: cpp
:name: splinefont.ImageList
typedef struct imagelist {
@@ -551,7 +551,7 @@ not support any other transformations on
transformations have been applied. The next field points to the next image, and
selected indicates whether this one is selected or not.
-.. code-block::
+.. code-block:: cpp
:name: splinefont.SplineChar
typedef struct splinechar {
@@ -623,7 +623,7 @@ follow this one. For instance the combin
SplineChar representing "V" would have a pointer to a
:ref:`KernPair <splinefont.KernPair>` with data on "A".
-.. code-block::
+.. code-block:: cpp
:name: splinefont.SplineFont
typedef struct splinefont {
Index: fontforge-20200314/doc/sphinx/ui/misc/fontforge-themes.rst
===================================================================
--- fontforge-20200314.orig/doc/sphinx/ui/misc/fontforge-themes.rst
+++ fontforge-20200314/doc/sphinx/ui/misc/fontforge-themes.rst
@@ -4,7 +4,7 @@ FontForge color schemes
The following are some suggestions for color schemes. You simply copy these into
your ~/.Xdefaults file and then run
-.. code-block::
+.. code-block:: bash
:name: fontforge-themes.shell
$ xrdb ~/.Xdefaults
Index: fontforge-20200314/doc/sphinx/conf.py
===================================================================
--- fontforge-20200314.orig/doc/sphinx/conf.py
+++ fontforge-20200314/doc/sphinx/conf.py
@@ -43,6 +43,7 @@ templates_path = ['_templates']
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
+master_doc = 'index'
# -- Options for HTML output -------------------------------------------------

View File

@ -0,0 +1,172 @@
commit 216eb14b558df344b206bf82e2bdaf03a1f2f429 (HEAD -> 216eb14b558df344b206bf82e2bdaf03a1f2f429_CVE-2024-25081_CVE-2024-25082)
Author: Peter Kydas <pk@canva.com>
Date: Tue Feb 6 20:03:04 2024 +1100
fix splinefont shell command injection (#5367)
diff -Nura fontforge-20230101/fontforge/splinefont.c fontforge-20230101_new/fontforge/splinefont.c
--- fontforge-20230101/fontforge/splinefont.c 2023-01-01 13:25:21.000000000 +0800
+++ fontforge-20230101_new/fontforge/splinefont.c 2024-03-04 21:23:26.813893591 +0800
@@ -788,11 +788,14 @@
char *Unarchive(char *name, char **_archivedir) {
char *dir = getenv("TMPDIR");
- char *pt, *archivedir, *listfile, *listcommand, *unarchivecmd, *desiredfile;
+ char *pt, *archivedir, *listfile, *desiredfile;
char *finalfile;
int i;
int doall=false;
static int cnt=0;
+ gchar *command[5];
+ gchar *stdoutresponse = NULL;
+ gchar *stderrresponse = NULL;
*_archivedir = NULL;
@@ -827,18 +830,30 @@
listfile = malloc(strlen(archivedir)+strlen("/" TOC_NAME)+1);
sprintf( listfile, "%s/" TOC_NAME, archivedir );
- listcommand = malloc( strlen(archivers[i].unarchive) + 1 +
- strlen( archivers[i].listargs) + 1 +
- strlen( name ) + 3 +
- strlen( listfile ) +4 );
- sprintf( listcommand, "%s %s %s > %s", archivers[i].unarchive,
- archivers[i].listargs, name, listfile );
- if ( system(listcommand)!=0 ) {
- free(listcommand); free(listfile);
- ArchiveCleanup(archivedir);
-return( NULL );
+ command[0] = archivers[i].unarchive;
+ command[1] = archivers[i].listargs;
+ command[2] = name;
+ command[3] = NULL; // command args need to be NULL-terminated
+
+ if ( g_spawn_sync(
+ NULL,
+ command,
+ NULL,
+ G_SPAWN_SEARCH_PATH,
+ NULL,
+ NULL,
+ &stdoutresponse,
+ &stderrresponse,
+ NULL,
+ NULL
+ ) == FALSE) { // did not successfully execute
+ ArchiveCleanup(archivedir);
+ return( NULL );
}
- free(listcommand);
+ // Write out the listfile to be read in later
+ FILE *fp = fopen(listfile, "wb");
+ fwrite(stdoutresponse, strlen(stdoutresponse), 1, fp);
+ fclose(fp);
desiredfile = ArchiveParseTOC(listfile, archivers[i].ars, &doall);
free(listfile);
@@ -847,22 +862,28 @@
return( NULL );
}
- /* I tried sending everything to stdout, but that doesn't work if the */
- /* output is a directory file (ufo, sfdir) */
- unarchivecmd = malloc( strlen(archivers[i].unarchive) + 1 +
- strlen( archivers[i].listargs) + 1 +
- strlen( name ) + 1 +
- strlen( desiredfile ) + 3 +
- strlen( archivedir ) + 30 );
- sprintf( unarchivecmd, "( cd %s ; %s %s %s %s ) > /dev/null", archivedir,
- archivers[i].unarchive,
- archivers[i].extractargs, name, doall ? "" : desiredfile );
- if ( system(unarchivecmd)!=0 ) {
- free(unarchivecmd); free(desiredfile);
- ArchiveCleanup(archivedir);
-return( NULL );
+ command[0] = archivers[i].unarchive;
+ command[1] = archivers[i].extractargs;
+ command[2] = name;
+ command[3] = doall ? "" : desiredfile;
+ command[4] = NULL;
+
+ if ( g_spawn_sync(
+ (gchar*)archivedir,
+ command,
+ NULL,
+ G_SPAWN_SEARCH_PATH,
+ NULL,
+ NULL,
+ &stdoutresponse,
+ &stderrresponse,
+ NULL,
+ NULL
+ ) == FALSE) { // did not successfully execute
+ free(desiredfile);
+ ArchiveCleanup(archivedir);
+ return( NULL );
}
- free(unarchivecmd);
finalfile = malloc( strlen(archivedir) + 1 + strlen(desiredfile) + 1);
sprintf( finalfile, "%s/%s", archivedir, desiredfile );
@@ -885,8 +906,12 @@
char *Decompress(char *name, int compression) {
char *dir = getenv("TMPDIR");
- char buf[1500];
char *tmpfn;
+ gchar *command[4];
+ gint stdout_pipe;
+ gchar buffer[4096];
+ gssize bytes_read;
+ GByteArray *binary_data = g_byte_array_new();
if ( dir==NULL ) dir = P_tmpdir;
tmpfn = malloc(strlen(dir)+strlen(GFileNameTail(name))+2);
@@ -894,11 +919,41 @@
strcat(tmpfn,"/");
strcat(tmpfn,GFileNameTail(name));
*strrchr(tmpfn,'.') = '\0';
- snprintf( buf, sizeof(buf), "%s < %s > %s", compressors[compression].decomp, name, tmpfn );
- if ( system(buf)==0 )
-return( tmpfn );
- free(tmpfn);
-return( NULL );
+
+ command[0] = compressors[compression].decomp;
+ command[1] = "-c";
+ command[2] = name;
+ command[3] = NULL;
+
+ // Have to use async because g_spawn_sync doesn't handle nul-bytes in the output (which happens with binary data)
+ if (g_spawn_async_with_pipes(
+ NULL,
+ command,
+ NULL,
+ G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ &stdout_pipe,
+ NULL,
+ NULL) == FALSE) {
+ //command has failed
+ return( NULL );
+ }
+
+ // Read binary data from pipe and output to file
+ while ((bytes_read = read(stdout_pipe, buffer, sizeof(buffer))) > 0) {
+ g_byte_array_append(binary_data, (guint8 *)buffer, bytes_read);
+ }
+ close(stdout_pipe);
+
+ FILE *fp = fopen(tmpfn, "wb");
+ fwrite(binary_data->data, sizeof(gchar), binary_data->len, fp);
+ fclose(fp);
+ g_byte_array_free(binary_data, TRUE);
+
+ return(tmpfn);
}
static char *ForceFileToHaveName(FILE *file, char *exten) {

View File

@ -1,3 +1,28 @@
-------------------------------------------------------------------
Tue Mar 5 12:17:37 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
- Add 642d8a3db6d4bc0e70b429622fdf01ecb09c4c10.patch: Fix build
with gettext 0.22.
-------------------------------------------------------------------
Sat Mar 2 03:24:22 UTC 2024 - Cliff Zhao <qzhao@suse.com>
- Add fontforge-CVE-2024-25081-CVE-2024-25082.patch
Backporting 216eb14b from upstream, Fix splinefont shell command
injection.
(CVE-2024-25081 CVE-2024-25082 bsc#1220404 bsc#1220405)
-------------------------------------------------------------------
Mon Feb 26 08:38:40 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
- Use %autosetup macro. Allows to eliminate the usage of deprecated
PatchN.
-------------------------------------------------------------------
Sun Dec 24 14:14:37 UTC 2023 - Marguerite Su <i@marguerite.su>
- drop fix-sphinx-doc.patch, upstream fixed
-------------------------------------------------------------------
Thu Mar 2 12:20:55 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package fontforge
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -26,8 +26,10 @@ Source0: https://github.com/fontforge/fontforge/archive/%{version}.tar.gz
# workaround for bug 930076, imho upstream should fix this
# https://github.com/fontforge/fontforge/issues/2270
Patch0: fontforge-version.patch
Patch2: fix-sphinx-doc.patch
Patch5: add-bitmap-transform-support.patch
Patch1: add-bitmap-transform-support.patch
# PATCH-FIX-UPSTREAM fontforge-CVE-2024-25081-CVE-2024-25082.patch CVE-2024-25081 CVE-2024-25082 bsc#1220404 bsc#1220405 qzhao@suse.com -- Fix Splinefont shell invocation.
Patch2: fontforge-CVE-2024-25081-CVE-2024-25082.patch
Patch3: https://github.com/fontforge/fontforge/commit/642d8a3db6d4bc0e70b429622fdf01ecb09c4c10.patch
BuildRequires: cairo-devel
BuildRequires: cmake
BuildRequires: fdupes
@ -92,12 +94,7 @@ This subpackage contains all necessary include files and libraries needed
to develop applications that use FontForge libraries.
%prep
%setup -q
%patch0 -p1
%if %{?suse_version} < 1550
%patch2 -p1
%endif
%patch5 -p1
%autosetup -p1
%build
%cmake \
@ -127,7 +124,6 @@ rm %{buildroot}%{_docdir}/%{name}/html/.nojekyll
%{_datadir}/icons/hicolor/*/apps/org.fontforge.FontForge.png
%{_datadir}/icons/hicolor/scalable/apps/org.fontforge.FontForge.svg
%{_datadir}/metainfo/org.fontforge.FontForge.*.xml
# %{_datadir}/pixmaps/org.fontforge.FontForge.*
%{_datadir}/mime/packages/%{name}.xml
%dir %{_docdir}/fontforge