pkgsrc-Changes archive

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

CVS commit: pkgsrc



Module Name:    pkgsrc
Committed By:   chuck
Date:           Wed Jun  8 19:00:13 UTC 2022

Modified Files:
        pkgsrc/doc: CHANGES-2022
        pkgsrc/fonts/t1lib: Makefile distinfo
Added Files:
        pkgsrc/fonts/t1lib/patches: patch-lib_type1_objects.h
            patch-lib_type1_regions.c

Log Message:
work around clang compiler issue and malloc overflow in t1lib

there are two bugs in fonts/t1lib that cause math/grace to crash on OSX:

[1] compiler bug in some versions of clang when compiling with "-O2" ...
    this appears to have been fixed somewhere between clang-11 and clang-12.
    it works ok with "-O1" and it doesn't impact my NetBSD system (which
    has gcc instead of clang).   resolve by using memcpy() in LONGCOPY()
    macro rather than using custom code that triggers the clang issue.
    see: https://mail-index.netbsd.org/tech-pkg/2022/06/08/msg026367.html

[2] one case of t1lib trying to be clever and instead writing past end of
     malloc'd buffer (which the OSX malloc did not like at all;  the netbsd
     malloc did not get messed up by this).   the address sanitizer helped
     pinpoint this.


To generate a diff of this commit:
cvs rdiff -u -r1.2960 -r1.2961 pkgsrc/doc/CHANGES-2022
cvs rdiff -u -r1.54 -r1.55 pkgsrc/fonts/t1lib/Makefile
cvs rdiff -u -r1.26 -r1.27 pkgsrc/fonts/t1lib/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/fonts/t1lib/patches/patch-lib_type1_objects.h \
    pkgsrc/fonts/t1lib/patches/patch-lib_type1_regions.c

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

Modified files:

Index: pkgsrc/doc/CHANGES-2022
diff -u pkgsrc/doc/CHANGES-2022:1.2960 pkgsrc/doc/CHANGES-2022:1.2961
--- pkgsrc/doc/CHANGES-2022:1.2960      Wed Jun  8 17:57:17 2022
+++ pkgsrc/doc/CHANGES-2022     Wed Jun  8 19:00:13 2022
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES-2022,v 1.2960 2022/06/08 17:57:17 adam Exp $
+$NetBSD: CHANGES-2022,v 1.2961 2022/06/08 19:00:13 chuck Exp $
 
 Changes to the packages collection and infrastructure in 2022:
 
@@ -4523,3 +4523,4 @@ Changes to the packages collection and i
        Updated devel/py-filelock to 3.7.1 [adam 2022-06-08]
        Updated lang/python310 to 3.10.5 [adam 2022-06-08]
        Updated lang/py310-html-docs to 3.10.5 [adam 2022-06-08]
+       Updated fonts/t1lib to 5.1.2nb7 [chuck 2022-06-08]

Index: pkgsrc/fonts/t1lib/Makefile
diff -u pkgsrc/fonts/t1lib/Makefile:1.54 pkgsrc/fonts/t1lib/Makefile:1.55
--- pkgsrc/fonts/t1lib/Makefile:1.54    Sat Nov  2 22:24:43 2019
+++ pkgsrc/fonts/t1lib/Makefile Wed Jun  8 19:00:13 2022
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.54 2019/11/02 22:24:43 rillig Exp $
+# $NetBSD: Makefile,v 1.55 2022/06/08 19:00:13 chuck Exp $
 
 DISTNAME=      t1lib-5.1.2
-PKGREVISION=   6
+PKGREVISION=   7
 CATEGORIES=    fonts devel graphics
 MASTER_SITES=  ${MASTER_SITE_SUNSITE:=libs/graphics/}
 

Index: pkgsrc/fonts/t1lib/distinfo
diff -u pkgsrc/fonts/t1lib/distinfo:1.26 pkgsrc/fonts/t1lib/distinfo:1.27
--- pkgsrc/fonts/t1lib/distinfo:1.26    Tue Oct 26 10:27:24 2021
+++ pkgsrc/fonts/t1lib/distinfo Wed Jun  8 19:00:13 2022
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.26 2021/10/26 10:27:24 nia Exp $
+$NetBSD: distinfo,v 1.27 2022/06/08 19:00:13 chuck Exp $
 
 BLAKE2s (t1lib-5.1.2.tar.gz) = cab979b401fbc8c24ff30dc580c2b9bb03338681861ec263b5d897df8a686ff2
 SHA512 (t1lib-5.1.2.tar.gz) = 9f424b19c6f35cc4f194ff7351a4c2352216462c7d1b1d9650ad3a05cf48c6e90c89ccbcda5ecc47a4169a39a850cf84a1fcbf88b3b15614860c27364b631ae3
@@ -12,3 +12,5 @@ SHA1 (patch-ai) = 372740d7166ebb999a3c28
 SHA1 (patch-aj) = bb915405fc5d64a74de09d7e4daba8822a08fbe1
 SHA1 (patch-ak) = abfbdb17c60b2068e95c5fe8e61ecfadbd85eea1
 SHA1 (patch-al) = b0f0ab9398ce7e3f3bc3e8e54097fd4dbb566bc8
+SHA1 (patch-lib_type1_objects.h) = bcb1d938d8cd6db5b32e8db2c1a050d39244679a
+SHA1 (patch-lib_type1_regions.c) = 75b12d30f73a649cbd0495a5cd735049a9bc4418

Added files:

Index: pkgsrc/fonts/t1lib/patches/patch-lib_type1_objects.h
diff -u /dev/null pkgsrc/fonts/t1lib/patches/patch-lib_type1_objects.h:1.1
--- /dev/null   Wed Jun  8 19:00:13 2022
+++ pkgsrc/fonts/t1lib/patches/patch-lib_type1_objects.h        Wed Jun  8 19:00:13 2022
@@ -0,0 +1,25 @@
+$NetBSD: patch-lib_type1_objects.h,v 1.1 2022/06/08 19:00:13 chuck Exp $
+
+Point LONGLONG macro at memcpy() rather than using t1lib custom code.
+The t1lib version causes some versions of clang to produce incorrect
+code when compiled with -O2.  Newer versions of clang (>= clang-12)
+have fixed the issue.  see note in:
+    https://mail-index.netbsd.org/tech-pkg/2022/06/08/msg026367.html
+
+--- lib/type1/objects.h.orig   2022-06-08 13:28:14.000000000 -0400
++++ lib/type1/objects.h        2022-06-08 13:28:29.000000000 -0400
+@@ -152,10 +152,14 @@
+ /*END SHARED*/
+ /*SHARED*/
+  
++#if 0
+ #define  LONGCOPY(dest,source,bytes) { \
+     register LONG *p1 = (LONG *)dest;  register LONG *p2 = (LONG *)source; \
+     register int count = (bytes) / sizeof(LONG); \
+     while (--count >= 0) *p1++ = *p2++; }
++#else
++#define  LONGCOPY(dest,source,bytes) memcpy(dest,source,bytes)
++#endif
+  
+  
+ /*END SHARED*/
Index: pkgsrc/fonts/t1lib/patches/patch-lib_type1_regions.c
diff -u /dev/null pkgsrc/fonts/t1lib/patches/patch-lib_type1_regions.c:1.1
--- /dev/null   Wed Jun  8 19:00:13 2022
+++ pkgsrc/fonts/t1lib/patches/patch-lib_type1_regions.c        Wed Jun  8 19:00:13 2022
@@ -0,0 +1,18 @@
+$NetBSD: patch-lib_type1_regions.c,v 1.1 2022/06/08 19:00:13 chuck Exp $
+
+Fixed incorrect calculation of ceiling that results in t1lib LONGCOPY
+writing past the end of a malloc buffer.   Corrects crash on OSX
+and resolves complaints from the address sanitizer.
+
+--- lib/type1/regions.c.orig   2022-06-08 13:28:23.000000000 -0400
++++ lib/type1/regions.c        2022-06-08 13:28:31.000000000 -0400
+@@ -340,7 +340,8 @@
+ longs.  The destination must be able to hold these extra bytes because
+ Allocate() makes everything it allocates be in multiples of longs.
+ */
+-       LONGCOPY(&r[1], xvalues, (ymax - iy) * sizeof(pel) + sizeof(LONG) - 1);
++       LONGCOPY(&r[1], xvalues,
++         ((ymax - iy) * sizeof(pel) + sizeof(LONG) - 1) & ~(sizeof(LONG) - 1));
+  
+        IfTrace1((RegionDebug),"result=%p\n", r);
+        return(r);



Home | Main Index | Thread Index | Old Index