pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/fonts/fontforge



Module Name:    pkgsrc
Committed By:   wiz
Date:           Sat Mar  9 20:31:48 UTC 2024

Modified Files:
        pkgsrc/fonts/fontforge: Makefile distinfo
Added Files:
        pkgsrc/fonts/fontforge/patches: patch-fontforge_splinefont.c

Log Message:
fontforge: fix CVE-2024-25081 & CVE-2024-25082

Using upstream patch.

Bump PKGREVISION.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 pkgsrc/fonts/fontforge/Makefile
cvs rdiff -u -r1.78 -r1.79 pkgsrc/fonts/fontforge/distinfo
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/fonts/fontforge/patches/patch-fontforge_splinefont.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/fonts/fontforge/Makefile
diff -u pkgsrc/fonts/fontforge/Makefile:1.142 pkgsrc/fonts/fontforge/Makefile:1.143
--- pkgsrc/fonts/fontforge/Makefile:1.142       Tue Nov 14 14:01:50 2023
+++ pkgsrc/fonts/fontforge/Makefile     Sat Mar  9 20:31:48 2024
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.142 2023/11/14 14:01:50 wiz Exp $
+# $NetBSD: Makefile,v 1.143 2024/03/09 20:31:48 wiz Exp $
 
 DISTNAME=      fontforge-20230101
-PKGREVISION=   5
+PKGREVISION=   6
 CATEGORIES=    fonts editors
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=fontforge/}
 GITHUB_PROJECT=        fontforge

Index: pkgsrc/fonts/fontforge/distinfo
diff -u pkgsrc/fonts/fontforge/distinfo:1.78 pkgsrc/fonts/fontforge/distinfo:1.79
--- pkgsrc/fonts/fontforge/distinfo:1.78        Fri Jun 30 06:48:06 2023
+++ pkgsrc/fonts/fontforge/distinfo     Sat Mar  9 20:31:48 2024
@@ -1,8 +1,9 @@
-$NetBSD: distinfo,v 1.78 2023/06/30 06:48:06 wiz Exp $
+$NetBSD: distinfo,v 1.79 2024/03/09 20:31:48 wiz Exp $
 
 BLAKE2s (fontforge-20230101.tar.xz) = aca0cb8014deafb2620ca3a19c494817a6c67ab24deb8da9c4bcbb099ee64d6c
 SHA512 (fontforge-20230101.tar.xz) = 7684a2824d5199e230d2e0a654c2119cef422a57b64e6dd75afde6ba623abed6581f596fd5b7509e03f3b3ad3cf69629aafd4c85aeda64fa91a9e1ab88c9b418
 Size (fontforge-20230101.tar.xz) = 13761728 bytes
+SHA1 (patch-fontforge_splinefont.c) = c8f7095f45a4f990ae37631b46583dec35a8eb5d
 SHA1 (patch-fontforge_splinefont.h) = be7739b6145b3c622913efa9f2d679860c35cccb
 SHA1 (patch-po_fr.po) = 4ab7a4636eac4580153c2594dea59a9a928cedbb
 SHA1 (patch-po_it.po) = 90a860516cf84790af8f08088f7b0d88f32cd895

Added files:

Index: pkgsrc/fonts/fontforge/patches/patch-fontforge_splinefont.c
diff -u /dev/null pkgsrc/fonts/fontforge/patches/patch-fontforge_splinefont.c:1.1
--- /dev/null   Sat Mar  9 20:31:48 2024
+++ pkgsrc/fonts/fontforge/patches/patch-fontforge_splinefont.c Sat Mar  9 20:31:48 2024
@@ -0,0 +1,172 @@
+$NetBSD: patch-fontforge_splinefont.c,v 1.1 2024/03/09 20:31:48 wiz Exp $
+
+https://github.com/fontforge/fontforge/pull/5367
+Fixes CVE-2024-25081 & CVE-2024-25082.
+
+--- fontforge/splinefont.c.orig        2023-01-01 05:25:39.000000000 +0000
++++ fontforge/splinefont.c
+@@ -788,11 +788,14 @@ return( name );
+ 
+ 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 @@ return( NULL );
+     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 );
+-    }
+-    free(listcommand);
++    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 );
++    }
++    // 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 );
+ 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,20 +906,54 @@ struct compressors compressors[] = {
+ 
+ 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);
+     strcpy(tmpfn,dir);
+     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) {



Home | Main Index | Thread Index | Old Index