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

libxfont: Changes to 'upstream-unstable'



 configure.ac             |   13 +++++++++-
 src/bitmap/bdfread.c     |   11 ++++++++
 src/fontfile/ffcheck.c   |   60 +++++++++++++++++++++++++++++++----------------
 src/fontfile/fontdir.c   |    8 ++++++
 src/fontfile/register.c  |   60 +++++++++++++++++++++++++++++++----------------
 src/stubs/Makefile.am    |    1 
 src/stubs/cauthgen.c     |    4 +++
 src/stubs/csignal.c      |    4 +++
 src/stubs/delfntcid.c    |    4 +++
 src/stubs/errorf.c       |    4 +++
 src/stubs/fatalerror.c   |    4 +++
 src/stubs/findoldfnt.c   |    4 +++
 src/stubs/fontmod.c      |   14 ++++++++++
 src/stubs/getcres.c      |    4 +++
 src/stubs/getdefptsize.c |    4 +++
 src/stubs/getnewfntcid.c |    4 +++
 src/stubs/gettime.c      |    4 +++
 src/stubs/initfshdl.c    |    4 +++
 src/stubs/regfpefunc.c   |    4 +++
 src/stubs/rmfshdl.c      |    4 +++
 src/stubs/servclient.c   |    4 +++
 src/stubs/setfntauth.c   |    4 +++
 src/stubs/stfntcfnt.c    |    4 +++
 src/stubs/xpstubs.c      |    5 +++
 src/util/atom.c          |   12 +++++++++
 src/util/miscutil.c      |   12 ++++++++-
 26 files changed, 218 insertions(+), 42 deletions(-)

New commits:
commit 87db45f5eb7880395735f7bf3a8ee2d89b7e0122
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date:   Wed Apr 4 17:05:13 2007 -0700

    Version bump: 1.2.8

diff --git a/configure.ac b/configure.ac
index 0fa4307..fb5cdec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ dnl Process this file with autoconf to create configure.
 AC_PREREQ([2.57])
 
 AC_INIT([libXfont],
-	1.2.7,
+	1.2.8,
 	[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
 	libXfont)
 dnl

commit e7a59cfb5d442d2965cfcffeff405a4b05591190
Author: Matthieu Herrb <matthieu@roadrock.(none)>
Date:   Tue Apr 3 15:45:21 2007 +0200

    Integer overflow vulnerabilities
    
    CVE-2007-1351: BDFFont Parsing Integer Overflow
    CVE-2007-1352: fonts.dir File Parsing Integer Overflow

diff --git a/src/bitmap/bdfread.c b/src/bitmap/bdfread.c
index acb77e9..a6f0c1e 100644
--- a/src/bitmap/bdfread.c
+++ b/src/bitmap/bdfread.c
@@ -65,6 +65,12 @@ from The Open Group.
 #include <X11/fonts/bitmap.h>
 #include <X11/fonts/bdfint.h>
 
+#if HAVE_STDINT_H
+#include <stdint.h>
+#elif !defined(INT32_MAX)
+#define INT32_MAX 0x7fffffff
+#endif
+
 #define INDICES 256
 #define MAXENCODING 0xFFFF
 #define BDFLINELEN  1024
@@ -288,6 +294,11 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
 	bdfError("invalid number of CHARS in BDF file\n");
 	return (FALSE);
     }
+    if (nchars > INT32_MAX / sizeof(CharInfoRec)) {
+	bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
+		 sizeof(CharInfoRec));
+	goto BAILOUT;
+    }
     ci = (CharInfoPtr) xalloc(nchars * sizeof(CharInfoRec));
     if (!ci) {
 	bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
diff --git a/src/fontfile/fontdir.c b/src/fontfile/fontdir.c
index aae1f2e..cf68a54 100644
--- a/src/fontfile/fontdir.c
+++ b/src/fontfile/fontdir.c
@@ -38,9 +38,17 @@ in this Software without prior written authorization from The Open Group.
 #include    <X11/fonts/fntfilst.h>
 #include    <X11/keysym.h>
 
+#if HAVE_STDINT_H
+#include <stdint.h>
+#elif !defined(INT32_MAX)
+#define INT32_MAX 0x7fffffff
+#endif
+
 Bool
 FontFileInitTable (FontTablePtr table, int size)
 {
+    if (size < 0 || (size > INT32_MAX/sizeof(FontEntryRec))) 
+	return FALSE;
     if (size)
     {
 	table->entries = (FontEntryPtr) xalloc(sizeof(FontEntryRec) * size);

commit 0fbb37ccc630ced42d6a973c81d947870cca7637
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date:   Mon Apr 2 17:40:19 2007 -0700

    Add #pragma weak for Sun cc where needed

diff --git a/src/stubs/cauthgen.c b/src/stubs/cauthgen.c
index 06f1a34..026c52d 100644
--- a/src/stubs/cauthgen.c
+++ b/src/stubs/cauthgen.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak client_auth_generation
+#endif
+
 weak int
 client_auth_generation(ClientPtr client)
 {
diff --git a/src/stubs/csignal.c b/src/stubs/csignal.c
index 3e102cc..e6fdeae 100644
--- a/src/stubs/csignal.c
+++ b/src/stubs/csignal.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak ClientSignal
+#endif
+
 weak Bool
 ClientSignal(ClientPtr client)
 {
diff --git a/src/stubs/delfntcid.c b/src/stubs/delfntcid.c
index 0b0a747..ca71328 100644
--- a/src/stubs/delfntcid.c
+++ b/src/stubs/delfntcid.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak DeleteFontClientID
+#endif
+
 weak void
 DeleteFontClientID(Font id)
 {
diff --git a/src/stubs/errorf.c b/src/stubs/errorf.c
index 28872e2..fd32965 100644
--- a/src/stubs/errorf.c
+++ b/src/stubs/errorf.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak ErrorF
+#endif
+
 weak void
 ErrorF(const char *f, ...)
 {
diff --git a/src/stubs/fatalerror.c b/src/stubs/fatalerror.c
index 295593e..1549ad3 100644
--- a/src/stubs/fatalerror.c
+++ b/src/stubs/fatalerror.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak FatalError
+#endif
+
 weak void
 FatalError(const char *f, ...)
 {
diff --git a/src/stubs/findoldfnt.c b/src/stubs/findoldfnt.c
index 22bd8c1..7a00084 100644
--- a/src/stubs/findoldfnt.c
+++ b/src/stubs/findoldfnt.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak find_old_font
+#endif
+
 weak FontPtr
 find_old_font(FSID id)
 {
diff --git a/src/stubs/fontmod.c b/src/stubs/fontmod.c
index d890b8d..5a0bd0e 100644
--- a/src/stubs/fontmod.c
+++ b/src/stubs/fontmod.c
@@ -6,5 +6,9 @@
 #include "stubs.h"
 #include <X11/fonts/fontmod.h>
 
+#ifdef __SUNPRO_C
+#pragma weak FontModuleList
+#endif
+
 weak FontModule *FontModuleList;
 #endif /* LOADABLEFONTS */
diff --git a/src/stubs/getcres.c b/src/stubs/getcres.c
index b564f24..0b98f46 100644
--- a/src/stubs/getcres.c
+++ b/src/stubs/getcres.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak GetClientResolutions
+#endif
+
 weak FontResolutionPtr
 GetClientResolutions(int *num)
 {
diff --git a/src/stubs/getdefptsize.c b/src/stubs/getdefptsize.c
index 11804dd..0b9e409 100644
--- a/src/stubs/getdefptsize.c
+++ b/src/stubs/getdefptsize.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak GetDefaultPointSize
+#endif
+
 weak int
 GetDefaultPointSize(void)
 {
diff --git a/src/stubs/getnewfntcid.c b/src/stubs/getnewfntcid.c
index aefc553..e2fe8bb 100644
--- a/src/stubs/getnewfntcid.c
+++ b/src/stubs/getnewfntcid.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak GetNewFontClientID
+#endif
+
 weak Font
 GetNewFontClientID(void)
 {
diff --git a/src/stubs/gettime.c b/src/stubs/gettime.c
index 1aca1cc..7b2d3b3 100644
--- a/src/stubs/gettime.c
+++ b/src/stubs/gettime.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak GetTimeInMillis
+#endif
+
 weak unsigned long
 GetTimeInMillis (void)
 {
diff --git a/src/stubs/initfshdl.c b/src/stubs/initfshdl.c
index faee9f6..a14daff 100644
--- a/src/stubs/initfshdl.c
+++ b/src/stubs/initfshdl.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak init_fs_handlers
+#endif
+
 weak int
 init_fs_handlers(FontPathElementPtr fpe,
                  BlockHandlerProcPtr block_handler)
diff --git a/src/stubs/regfpefunc.c b/src/stubs/regfpefunc.c
index 67e43b3..a79b4bf 100644
--- a/src/stubs/regfpefunc.c
+++ b/src/stubs/regfpefunc.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak RegisterFPEFunctions
+#endif
+
 weak int 
 RegisterFPEFunctions(NameCheckFunc name_func, 
 		     InitFpeFunc init_func, 
diff --git a/src/stubs/rmfshdl.c b/src/stubs/rmfshdl.c
index 1f87744..d0bdd3d 100644
--- a/src/stubs/rmfshdl.c
+++ b/src/stubs/rmfshdl.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak remove_fs_handlers
+#endif
+
 weak void 
 remove_fs_handlers(FontPathElementPtr fpe,
                    BlockHandlerProcPtr blockHandler,
diff --git a/src/stubs/servclient.c b/src/stubs/servclient.c
index ae51621..9b6cebb 100644
--- a/src/stubs/servclient.c
+++ b/src/stubs/servclient.c
@@ -3,4 +3,8 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak serverClient
+#endif
+
 weak void *serverClient = 0;
diff --git a/src/stubs/setfntauth.c b/src/stubs/setfntauth.c
index 01d18b1..0c7eccc 100644
--- a/src/stubs/setfntauth.c
+++ b/src/stubs/setfntauth.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak set_font_authorizations
+#endif
+
 weak int
 set_font_authorizations(char **authorizations, int *authlen, ClientPtr client)
 {
diff --git a/src/stubs/stfntcfnt.c b/src/stubs/stfntcfnt.c
index bf88505..5fc1745 100644
--- a/src/stubs/stfntcfnt.c
+++ b/src/stubs/stfntcfnt.c
@@ -3,6 +3,10 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak StoreFontClientFont
+#endif
+
 weak int
 StoreFontClientFont(FontPtr pfont, Font id)
 {
diff --git a/src/stubs/xpstubs.c b/src/stubs/xpstubs.c
index cb5d76d..939b34f 100644
--- a/src/stubs/xpstubs.c
+++ b/src/stubs/xpstubs.c
@@ -3,6 +3,11 @@
 #endif
 #include "stubs.h"
 
+#ifdef __SUNPRO_C
+#pragma weak XpClientIsBitmapClient
+#pragma weak XpClientIsPrintClient
+#endif
+
 weak Bool
 XpClientIsBitmapClient(ClientPtr client)
 {
diff --git a/src/util/atom.c b/src/util/atom.c
index e5fea46..b770dc9 100644
--- a/src/util/atom.c
+++ b/src/util/atom.c
@@ -146,6 +146,10 @@ NameEqual (const char *a, const char *b, int l)
     return TRUE;
 }
 
+#ifdef __SUNPRO_C
+#pragma weak MakeAtom
+#endif
+
 weak Atom 
 MakeAtom(char *string, unsigned len, int makeit)
 {
@@ -219,12 +223,20 @@ MakeAtom(char *string, unsigned len, int makeit)
     return a->atom;
 }
 
+#ifdef __SUNPRO_C
+#pragma weak ValidAtom
+#endif
+
 weak int 
 ValidAtom(Atom atom)
 {
     return (atom != None) && (atom <= lastAtom);
 }
 
+#ifdef __SUNPRO_C
+#pragma weak NameForAtom
+#endif
+
 weak char *
 NameForAtom(Atom atom)
 {
diff --git a/src/util/miscutil.c b/src/util/miscutil.c
index 611f912..43473b7 100644
--- a/src/util/miscutil.c
+++ b/src/util/miscutil.c
@@ -40,8 +40,18 @@ from The Open Group.
 #define XK_LATIN1
 #include    <X11/keysymdef.h>
 
-/* make sure everything initializes themselves at least once */
 
+#ifdef __SUNPRO_C
+#pragma weak serverGeneration
+#pragma weak Xalloc
+#pragma weak Xrealloc
+#pragma weak Xfree
+#pragma weak Xcalloc
+#pragma weak CopyISOLatin1Lowered
+#pragma weak register_fpe_functions
+#endif
+
+/* make sure everything initializes themselves at least once */
 weak long serverGeneration = 1;
 
 weak void *

commit cc824e4f2c9a53a00b36a6f83bf065c363027087
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date:   Fri Mar 23 15:57:29 2007 -0700

    Actually use loadable font modules
    
    Loadable font modules were not being initialized, and all font renderers
    known at build time were always being initialized, regardless of Xorg
    module configuration.

diff --git a/configure.ac b/configure.ac
index 9797d69..0fa4307 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,6 +171,14 @@ if test "x$XFONT_FONTFILE" = xyes; then
 	AC_DEFINE(XFONT_FONTFILE,1,[Support fonts in files])
 fi
 
+AC_ARG_ENABLE(loadable-font-modules, 
+  AC_HELP_STRING([--disable-loadable-font-modules], 
+       	 [support dynamically loaded font modules (default is enabled)]),
+	[LOADABLE_FONTS=$enableval], [LOADABLE_FONTS=yes])
+if test "x$LOADABLE_FONTS" = xyes; then
+	AC_DEFINE(LOADABLEFONTS,1,[Support dynamically loaded font modules])
+fi
+
 #
 # Font cache extension support?
 #
diff --git a/src/fontfile/ffcheck.c b/src/fontfile/ffcheck.c
index d03be4f..ea0b3b4 100644
--- a/src/fontfile/ffcheck.c
+++ b/src/fontfile/ffcheck.c
@@ -37,9 +37,7 @@ in this Software without prior written authorization from The Open Group.
 #endif
 #include <X11/fonts/fntfilst.h>
 #include <X11/fonts/bitmap.h>
-#ifdef LOADABLEFONTS
 #include <X11/fonts/fontmod.h>
-#endif
 
 /*
  * Map FPE functions to renderer functions
@@ -118,37 +116,59 @@ FontFileCheckListNextFontOrAlias(pointer client, FontPathElementPtr fpe,
     return BadFontName;
 }
 
-void
-FontFileCheckRegisterFpeFunctions (void)
-{
-#ifndef LOADABLEFONTS
-    BitmapRegisterFontFileFunctions ();
-
-
+/* Font renderers to initialize when not linked into something like
+   Xorg that provides its own module configuration options */
+static const FontModule builtinFontModuleList[] = {
 #ifdef XFONT_SPEEDO
-    SpeedoRegisterFontFileFunctions ();
+    {
+	SpeedoRegisterFontFileFunctions,
+	"speedo",
+	NULL
+    },
 #endif
 #ifdef XFONT_TYPE1
-    Type1RegisterFontFileFunctions();
+    {
+	Type1RegisterFontFileFunctions,
+	"type1",
+	NULL
+    },
 #endif
-#ifdef XFONT_FREETYPE
-    FreeTypeRegisterFontFileFunctions();
+#ifdef XFONT_FREETYPE    
+    {
+	FreeTypeRegisterFontFileFunctions,
+	"freetype",
+	NULL
+    },
 #endif
+    /* List terminator - must be last entry */
+    {	NULL, NULL, NULL }
+};
 
+void
+FontFileCheckRegisterFpeFunctions (void)
+{
+    FontModule *fmlist = builtinFontModuleList;
+    
+#ifdef XFONT_BITMAP
+    /* bitmap is always builtin to libXfont now */
+    BitmapRegisterFontFileFunctions ();
+#endif
 
-#else
+#ifdef LOADABLEFONTS
+    if (FontModuleList) {
+	fmlist = FontModuleList;
+    }
+#endif
 
-    {
+    if (fmlist) {
 	int i;
 
-	if (FontModuleList) {
-	    for (i = 0; FontModuleList[i].name; i++) {
-		if (FontModuleList[i].initFunc)
-		    FontModuleList[i].initFunc();
+	for (i = 0; fmlist[i].name; i++) {
+	    if (fmlist[i].initFunc) {
+		fmlist[i].initFunc();
 	    }
 	}
     }
-#endif
 
     RegisterFPEFunctions(FontFileNameCheck,
 			 FontFileInitFPE,
diff --git a/src/fontfile/register.c b/src/fontfile/register.c
index 53016b2..a591838 100644
--- a/src/fontfile/register.c
+++ b/src/fontfile/register.c
@@ -42,10 +42,7 @@ in this Software without prior written authorization from The Open Group.
 #include <X11/fonts/fontmisc.h>
 #include <X11/fonts/fntfilst.h>
 #include <X11/fonts/bitmap.h>
-
-#ifdef LOADABLEFONTS
 #include <X11/fonts/fontmod.h>
-#endif
 
 /*
  * Translate monolithic build symbols to modular build symbols.
@@ -67,36 +64,59 @@ in this Software without prior written authorization from The Open Group.
 # define XFONT_FREETYPE 1
 #endif
 
+/* Font renderers to initialize when not linked into something like
+   Xorg that provides its own module configuration options */
+static const FontModule builtinFontModuleList[] = {
+#ifdef XFONT_SPEEDO
+    {
+	SpeedoRegisterFontFileFunctions,
+	"speedo",
+	NULL
+    },
+#endif
+#ifdef XFONT_TYPE1
+    {
+	Type1RegisterFontFileFunctions,
+	"type1",
+	NULL
+    },
+#endif
+#ifdef XFONT_FREETYPE    
+    {
+	FreeTypeRegisterFontFileFunctions,
+	"freetype",
+	NULL
+    },
+#endif
+    /* List terminator - must be last entry */
+    {	NULL, NULL, NULL }
+};
+
 void
 FontFileRegisterFpeFunctions(void)
 {
-#ifndef LOADABLEFONTS
+    FontModule *fmlist = builtinFontModuleList;
 
 #ifdef XFONT_BITMAP
+    /* bitmap is always builtin to libXfont now */
     BitmapRegisterFontFileFunctions ();
 #endif
-#ifdef XFONT_SPEEDO
-    SpeedoRegisterFontFileFunctions ();
-#endif
-#ifdef XFONT_TYPE1
-    Type1RegisterFontFileFunctions();
-#endif
-#ifdef XFONT_FREETYPE
-    FreeTypeRegisterFontFileFunctions();
-#endif
 
-#else
-    {
+#ifdef LOADABLEFONTS
+    if (FontModuleList) {
+	fmlist = FontModuleList;
+    }
+#endif    
+
+    if (fmlist) {
 	int i;
 
-	if (FontModuleList) {
-	    for (i = 0; FontModuleList[i].name; i++) {
-		if (FontModuleList[i].initFunc)
-		    FontModuleList[i].initFunc();
+	for (i = 0; fmlist[i].name; i++) {
+	    if (fmlist[i].initFunc) {
+		fmlist[i].initFunc();
 	    }
 	}
     }
-#endif
     
     FontFileRegisterLocalFpeFunctions ();
 }
diff --git a/src/stubs/Makefile.am b/src/stubs/Makefile.am
index d9f4942..acee880 100644
--- a/src/stubs/Makefile.am
+++ b/src/stubs/Makefile.am
@@ -10,6 +10,7 @@ libstubs_la_SOURCES = 		\
 	errorf.c		\
 	fatalerror.c		\
 	findoldfnt.c		\
+	fontmod.c		\
 	getcres.c		\
 	getdefptsize.c		\
 	getnewfntcid.c		\
diff --git a/src/stubs/fontmod.c b/src/stubs/fontmod.c
new file mode 100644
index 0000000..d890b8d
--- /dev/null
+++ b/src/stubs/fontmod.c
@@ -0,0 +1,10 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef LOADABLEFONTS
+#include "stubs.h"
+#include <X11/fonts/fontmod.h>
+
+weak FontModule *FontModuleList;
+#endif /* LOADABLEFONTS */

commit fc6e22f238d34918156ded34148730075b7b9cc2
Author: Ben Byer <bbyer@bbyer.(none)>
Date:   Tue Feb 20 00:20:23 2007 -0800

    added -flat_namespace to CFLAGS for Darwin

diff --git a/configure.ac b/configure.ac
index d062929..9797d69 100644
--- a/configure.ac
+++ b/configure.ac
@@ -218,6 +218,9 @@ case $host_os in
     linux*)
         OS_CFLAGS="-D_XOPEN_SOURCE"
         ;;
+    darwin*)
+        OS_CFLAGS="-Wl,-flat_namespace"
+	;;
     *)
         OS_CFLAGS=
         ;;



Reply to: