[152805] trunk/dports/x11/mkfontscale

jeremyhu at macports.org jeremyhu at macports.org
Sun Sep 18 16:31:38 PDT 2016


Revision: 152805
          https://trac.macports.org/changeset/152805
Author:   jeremyhu at macports.org
Date:     2016-09-18 16:31:38 -0700 (Sun, 18 Sep 2016)
Log Message:
-----------
mkfontscale: Fix a buffer underrun

Modified Paths:
--------------
    trunk/dports/x11/mkfontscale/Portfile

Added Paths:
-----------
    trunk/dports/x11/mkfontscale/files/
    trunk/dports/x11/mkfontscale/files/0001-fix-handling-of-Type1-fonts-without-FamilyName-and-o.patch
    trunk/dports/x11/mkfontscale/files/0002-mkfontscale-Avoid-a-buffer-underrun.patch

Modified: trunk/dports/x11/mkfontscale/Portfile
===================================================================
--- trunk/dports/x11/mkfontscale/Portfile	2016-09-18 23:09:12 UTC (rev 152804)
+++ trunk/dports/x11/mkfontscale/Portfile	2016-09-18 23:31:38 UTC (rev 152805)
@@ -4,6 +4,7 @@
 
 name                mkfontscale
 version             1.1.2
+revision            1
 categories          x11
 license             X11
 platforms           darwin
@@ -32,6 +33,11 @@
 	port:bzip2 \
 	port:zlib
 
+patch.pre_args -p1
+patchfiles-append \
+	0001-fix-handling-of-Type1-fonts-without-FamilyName-and-o.patch \
+	0002-mkfontscale-Avoid-a-buffer-underrun.patch 
+
 livecheck.type  regex
 livecheck.url   http://xorg.freedesktop.org/archive/individual/app/?C=M&O=D
 livecheck.regex ${name}-(\\d+(?:\\.\\d+)*)

Added: trunk/dports/x11/mkfontscale/files/0001-fix-handling-of-Type1-fonts-without-FamilyName-and-o.patch
===================================================================
--- trunk/dports/x11/mkfontscale/files/0001-fix-handling-of-Type1-fonts-without-FamilyName-and-o.patch	                        (rev 0)
+++ trunk/dports/x11/mkfontscale/files/0001-fix-handling-of-Type1-fonts-without-FamilyName-and-o.patch	2016-09-18 23:31:38 UTC (rev 152805)
@@ -0,0 +1,39 @@
+From ecb248d8865df376a97a795c2e4f58a3bf64c3f1 Mon Sep 17 00:00:00 2001
+From: Stefan Dirsch <sndirsch at suse.de>
+Date: Thu, 21 Apr 2016 16:52:15 +0200
+Subject: [PATCH 1/2] fix handling of Type1 fonts without /FamilyName and/or
+ /FullName
+
+https://bugzilla.opensuse.org/show_bug.cgi?id=918466
+
+Signed-off-by: Stefan Dirsch <sndirsch at suse.de>
+Reviewed-by: Adam Jackson <ajax at redhat.com>
+---
+ mkfontscale.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/mkfontscale.c b/mkfontscale.c
+index da93e0c..e9b9488 100644
+--- a/mkfontscale.c
++++ b/mkfontscale.c
+@@ -579,11 +579,14 @@ makeXLFD(char *filename, FT_Face face, int isBitmap)
+     }
+ 
+     if(t1info) {
+-        if(!family)
++        if(!family && t1info->family_name)
+             family = strdup(t1info->family_name);
+-        if(!family)
++        if(!family && t1info->full_name)
+             family = strdup(t1info->full_name);
+-        if(!full_name)
++        /* Hershey fonts miss /FamilyName */
++        if(!family && face->family_name)
++            family = strdup(face->family_name);
++        if(!full_name && t1info->full_name)
+             full_name = strdup(t1info->full_name);
+         if(!foundry)
+             foundry = notice_foundry(t1info->notice);
+-- 
+2.10.0 (Apple Git-77)
+

Added: trunk/dports/x11/mkfontscale/files/0002-mkfontscale-Avoid-a-buffer-underrun.patch
===================================================================
--- trunk/dports/x11/mkfontscale/files/0002-mkfontscale-Avoid-a-buffer-underrun.patch	                        (rev 0)
+++ trunk/dports/x11/mkfontscale/files/0002-mkfontscale-Avoid-a-buffer-underrun.patch	2016-09-18 23:31:38 UTC (rev 152805)
@@ -0,0 +1,48 @@
+From 07b761b0862bcea65b83052b9d960c4459af0466 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
+Date: Sun, 18 Sep 2016 16:25:22 -0700
+Subject: [PATCH 2/2] mkfontscale: Avoid a buffer underrun
+
+https://bugs.freedesktop.org/show_bug.cgi?id=96905
+
+=================================================================
+==3068==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300000de6f at pc 0x000109df79d1 bp 0x7fff55e37d90 sp 0x7fff55e37550
+READ of size 1 at 0x60300000de6f thread T0
+    #0 0x109df79d0 in wrap_strcmp (libclang_rt.asan_osx_dynamic.dylib+0xe9d0)
+    #1 0x109dc8ef7 in fontFileOpen (mkfontscale+0x100001ef7)
+    #2 0x109dc8e0b in bitmapIdentify (mkfontscale+0x100001e0b)
+    #3 0x109dcc874 in doDirectory (mkfontscale+0x100005874)
+    #4 0x109dcbc78 in main (mkfontscale+0x100004c78)
+    #5 0x7fff9083f5ac in start (libdyld.dylib+0x35ac)
+    #6 0x3  (<unknown module>)
+
+0x60300000de6f is located 1 bytes to the left of 20-byte region [0x60300000de70,0x60300000de84)
+allocated by thread T0 here:
+    #0 0x109e34570 in wrap_malloc (libclang_rt.asan_osx_dynamic.dylib+0x4b570)
+    #1 0x109dca92a in dsprintf (mkfontscale+0x10000392a)
+    #2 0x109dcc788 in doDirectory (mkfontscale+0x100005788)
+    #3 0x109dcbc78 in main (mkfontscale+0x100004c78)
+    #4 0x7fff9083f5ac in start (libdyld.dylib+0x35ac)
+    #5 0x3  (<unknown module>)
+
+Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
+---
+ ident.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ident.c b/ident.c
+index 22d3648..f7fe9e1 100644
+--- a/ident.c
++++ b/ident.c
+@@ -83,7 +83,7 @@ static inline void *
+ fontFileOpen(fontFile *ff, const char *filename) {
+     int n = strlen(filename);
+ 
+-    if (strcmp(filename + n - 4, ".bz2") == 0) {
++    if (n > 4 && strcmp(filename + n - 4, ".bz2") == 0) {
+ 	ff->type = bz2FontFile;
+ 	ff->f.bz2 = BZ2_bzopen(filename, "rb");
+ 	ff->pos = 0;
+-- 
+2.10.0 (Apple Git-77)
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160918/e3f17d60/attachment.html>


More information about the macports-changes mailing list