summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2013-08-06 14:18:16 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2013-08-06 14:18:16 +0000
commit9f80cea7a79d9ea05c8ac3497aba15bb07ddbdc7 (patch)
treeee5eeddbbc67590a45737342538a62c90dbae1d8
parentbe2f62b1c99597ad47dde539964c3a4a3b5cf773 (diff)
ttf2pk, ttf2pk2: Use mycalloc() to avoid uninitialized TFM header words
git-svn-id: svn://tug.org/texlive/trunk@31365 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/ttf2pk/ChangeLog6
-rw-r--r--Build/source/texk/ttf2pk/newobj.c16
-rw-r--r--Build/source/texk/ttf2pk/newobj.h10
-rw-r--r--Build/source/texk/ttf2pk/tfmaux.c2
-rw-r--r--Build/source/texk/ttf2pk2/ChangeLog4
-rw-r--r--Build/source/texk/ttf2pk2/tfmaux.c2
6 files changed, 36 insertions, 4 deletions
diff --git a/Build/source/texk/ttf2pk/ChangeLog b/Build/source/texk/ttf2pk/ChangeLog
index 336c578eaa7..bbf06c4097d 100644
--- a/Build/source/texk/ttf2pk/ChangeLog
+++ b/Build/source/texk/ttf2pk/ChangeLog
@@ -1,3 +1,9 @@
+2013-08-06 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * tfmaux.c: Use mycalloc() to initialize header array (with 0).
+ * newobj.[ch]: Replace my{m,c,re}alloc() => x{m,c,re}alloc()
+ when using KPATHSEA, otherwise declare and define mycalloc().
+
2013-07-30 Peter Breitenlohner <peb@mppmu.mpg.de>
* ttf2tfm.c: Build title with progname instead of argv[0] as
diff --git a/Build/source/texk/ttf2pk/newobj.c b/Build/source/texk/ttf2pk/newobj.c
index 1c741f99e29..eede1470a9d 100644
--- a/Build/source/texk/ttf2pk/newobj.c
+++ b/Build/source/texk/ttf2pk/newobj.c
@@ -22,6 +22,7 @@
#include "texenc.h"
+#if !defined(HAVE_LIBKPATHSEA)
void *
mymalloc(size_t len)
{
@@ -46,6 +47,20 @@ mymalloc(size_t len)
void *
+mycalloc(size_t nmemb, size_t len)
+{
+ void *p;
+
+ p = calloc(nmemb ? nmemb : 1, len ? len : 1);
+
+ if (p == NULL)
+ oops("Out of memory.");
+
+ return p;
+}
+
+
+void *
myrealloc(void *oldp, size_t len)
{
void *p;
@@ -66,6 +81,7 @@ myrealloc(void *oldp, size_t len)
return p;
}
+#endif
/*
diff --git a/Build/source/texk/ttf2pk/newobj.h b/Build/source/texk/ttf2pk/newobj.h
index 52beb0737ea..7fe4c2c72c1 100644
--- a/Build/source/texk/ttf2pk/newobj.h
+++ b/Build/source/texk/ttf2pk/newobj.h
@@ -15,15 +15,21 @@
#include "ttf2tfm.h"
+#if defined(HAVE_LIBKPATHSEA)
+#include <kpathsea/config.h>
+#define mymalloc xmalloc
+#define mycalloc xcalloc
+#define myrealloc xrealloc
+#else
#if (defined(MSDOS) && defined(__TURBOC__)) || \
(defined(OS2) && defined(_MSC_VER))
#define SMALLMALLOC
#endif
-
void *mymalloc(size_t len);
-void *mycalloc(size_t len);
+void *mycalloc(size_t nmemb, size_t len);
void *myrealloc(void *oldp, size_t len);
+#endif
char *get_line(FILE *f);
Boolean texlive_getline(char **bufferp, FILE *f);
diff --git a/Build/source/texk/ttf2pk/tfmaux.c b/Build/source/texk/ttf2pk/tfmaux.c
index fb379e2b07c..d0fe18cf14a 100644
--- a/Build/source/texk/ttf2pk/tfmaux.c
+++ b/Build/source/texk/ttf2pk/tfmaux.c
@@ -367,7 +367,7 @@ buildtfm(Font *fnt)
oops("No TTF characters.");
}
- header = (long *)mymalloc(40000L);
+ header = (long *)mycalloc(40000L, sizeof(char));
fnt->cksum = checksum(fnt->inencptrs);
header[0] = fnt->cksum;
header[1] = 0xA00000; /* 10pt design size */
diff --git a/Build/source/texk/ttf2pk2/ChangeLog b/Build/source/texk/ttf2pk2/ChangeLog
index 1a3ecba0cab..65e89cd4a96 100644
--- a/Build/source/texk/ttf2pk2/ChangeLog
+++ b/Build/source/texk/ttf2pk2/ChangeLog
@@ -1,3 +1,7 @@
+2013-08-06 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * tfmaux.c: Use mycalloc() to initialize header array (with 0).
+
2013-07-18 Peter Breitenlohner <peb@mppmu.mpg.de>
* ttf2tfm.c: Build title with progname instead of argv[0] as
diff --git a/Build/source/texk/ttf2pk2/tfmaux.c b/Build/source/texk/ttf2pk2/tfmaux.c
index fb379e2b07c..d0fe18cf14a 100644
--- a/Build/source/texk/ttf2pk2/tfmaux.c
+++ b/Build/source/texk/ttf2pk2/tfmaux.c
@@ -367,7 +367,7 @@ buildtfm(Font *fnt)
oops("No TTF characters.");
}
- header = (long *)mymalloc(40000L);
+ header = (long *)mycalloc(40000L, sizeof(char));
fnt->cksum = checksum(fnt->inencptrs);
header[0] = fnt->cksum;
header[1] = 0xA00000; /* 10pt design size */