pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/fonts/ttmkfdir2
Module Name: pkgsrc
Committed By: dholland
Date: Thu Jan 1 23:59:17 UTC 2026
Modified Files:
pkgsrc/fonts/ttmkfdir2: Makefile
pkgsrc/fonts/ttmkfdir2/patches: patch-ab
Added Files:
pkgsrc/fonts/ttmkfdir2/patches: patch-ttf.h
Log Message:
fonts/ttmkfdir2: avoid undefined behavior
The function that produced the font foundry name was returning a
pointer to its own automatic storage for cases where it was generating
"misc" for an unknown foundry. This is just as invalid in C++ as it is
in C, and dressing it up in C++ goop just made it harder to see that
it was wrong.
XXX: There's half a dozen entries in the foundry table here that are
XXX: unmatchable because they're lower-case and it does toupper()
XXX: before matching.
To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 pkgsrc/fonts/ttmkfdir2/Makefile
cvs rdiff -u -r1.4 -r1.5 pkgsrc/fonts/ttmkfdir2/patches/patch-ab
cvs rdiff -u -r0 -r1.1 pkgsrc/fonts/ttmkfdir2/patches/patch-ttf.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/fonts/ttmkfdir2/Makefile
diff -u pkgsrc/fonts/ttmkfdir2/Makefile:1.25 pkgsrc/fonts/ttmkfdir2/Makefile:1.26
--- pkgsrc/fonts/ttmkfdir2/Makefile:1.25 Sun Nov 12 13:21:27 2023
+++ pkgsrc/fonts/ttmkfdir2/Makefile Thu Jan 1 23:59:16 2026
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.25 2023/11/12 13:21:27 wiz Exp $
+# $NetBSD: Makefile,v 1.26 2026/01/01 23:59:16 dholland Exp $
#
DISTNAME= ttmkfdir2.20021109
PKGNAME= ${DISTNAME:S/./-/}
-PKGREVISION= 8
+PKGREVISION= 9
CATEGORIES= fonts x11
MASTER_SITES= http://people.redhat.com/yshao/
EXTRACT_SUFX= .tar.bz2
Index: pkgsrc/fonts/ttmkfdir2/patches/patch-ab
diff -u pkgsrc/fonts/ttmkfdir2/patches/patch-ab:1.4 pkgsrc/fonts/ttmkfdir2/patches/patch-ab:1.5
--- pkgsrc/fonts/ttmkfdir2/patches/patch-ab:1.4 Wed Dec 11 23:49:52 2013
+++ pkgsrc/fonts/ttmkfdir2/patches/patch-ab Thu Jan 1 23:59:16 2026
@@ -1,7 +1,15 @@
-$NetBSD: patch-ab,v 1.4 2013/12/11 23:49:52 markd Exp $
+$NetBSD: patch-ab,v 1.5 2026/01/01 23:59:16 dholland Exp $
---- ttf.cpp.orig 2002-11-07 06:30:04.000000000 +0100
-+++ ttf.cpp 2007-11-15 07:05:27.304109000 +0100
+- include freetype headers properly
+- work around some sunpro C++ dialect issue
+- fix wrong return type in FontFamilyName()
+- avoid UB in FoundryName()
+ (was returning a pointer to automatic storage, make it return the
+ object instead)
+- some other C++ workaround involving implicit conversions and booleans
+
+--- ttf.cpp.orig 2002-11-07 05:30:04.000000000 +0000
++++ ttf.cpp
@@ -3,7 +3,8 @@
#include <cctype>
#include <cstring>
@@ -34,6 +42,33 @@ $NetBSD: patch-ab,v 1.4 2013/12/11 23:49
};
platform = NamePtr.platform_id;
encoding = NamePtr.encoding_id;
+@@ -249,7 +255,7 @@ Face::FontFamilyName (void) const
+ return "unknown";
+ }
+
+-const char *
++std::string
+ Face::FoundryName (void) const
+ {
+
+@@ -455,7 +461,7 @@ Face::FoundryName (void) const
+ code[4] = 0;
+
+ if (code[0] == 0) {
+- return std::string (cmdline::instance()->option ("default-foundry")).c_str ();
++ return std::string (cmdline::instance()->option ("default-foundry"));
+ }
+
+ for (p = known_foundries; p->xlfd; p++) {
+@@ -464,7 +470,7 @@ Face::FoundryName (void) const
+ }
+ }
+
+- return std::string (cmdline::instance()->option ("default-foundry")).c_str ();
++ return std::string (cmdline::instance()->option ("default-foundry"));
+ }
+
+ const char *
@@ -522,7 +528,7 @@ Face::Weight (void) const
{
const char *result;
Added files:
Index: pkgsrc/fonts/ttmkfdir2/patches/patch-ttf.h
diff -u /dev/null pkgsrc/fonts/ttmkfdir2/patches/patch-ttf.h:1.1
--- /dev/null Thu Jan 1 23:59:17 2026
+++ pkgsrc/fonts/ttmkfdir2/patches/patch-ttf.h Thu Jan 1 23:59:16 2026
@@ -0,0 +1,15 @@
+$NetBSD: patch-ttf.h,v 1.1 2026/01/01 23:59:16 dholland Exp $
+
+Avoid UB in FoundryName()
+
+--- ttf.h~ 2026-01-01 23:05:18.789393675 +0000
++++ ttf.h
+@@ -24,7 +24,7 @@ namespace ttf {
+ Face (const std::string &filename);
+ ~Face (void);
+ const char *FontFamilyName (void) const;
+- const char *FoundryName (void) const;
++ std::string FoundryName (void) const;
+ const char *Weight (void) const;
+ const char *Width (void) const;
+ xlfdcontainer xlfdnames;
Home |
Main Index |
Thread Index |
Old Index