README | 59 +++++++++ configure.ac | 49 +++++-- include/X11/fonts/fntfil.h | 14 +- include/X11/fonts/fontmisc.h | 2 src/FreeType/ftfuncs.c | 4 src/FreeType/xttcap.c | 1 src/Makefile.am | 2 src/bitmap/Makefile.am | 24 ++- src/bitmap/bitmap.c | 6 src/bitmap/bitmapfunc.c | 31 ++-- src/bitmap/bitscale.c | 26 ---- src/builtins/builtin.h | 4 src/builtins/dir.c | 2 src/builtins/file.c | 2 src/builtins/fpe.c | 5 src/fc/fsconvert.c | 18 ++ src/fc/fserve.c | 272 ++++++++++++++++++++++++++++++++++++++----- src/fc/fserve.h | 2 src/fc/fsio.h | 3 src/fontfile/bufio.c | 6 src/fontfile/catalogue.c | 35 ++--- src/fontfile/dirfile.c | 8 + src/fontfile/fontdir.c | 5 src/fontfile/fontfile.c | 16 +- src/fontfile/renderers.c | 6 src/stubs/Makefile.am | 2 src/stubs/cauthgen.c | 1 src/stubs/csignal.c | 1 src/stubs/delfntcid.c | 1 src/stubs/errorf.c | 1 src/stubs/fatalerror.c | 13 -- src/stubs/findoldfnt.c | 1 src/stubs/getcres.c | 1 src/stubs/getdefptsize.c | 1 src/stubs/getnewfntcid.c | 1 src/stubs/gettime.c | 1 src/stubs/initfshdl.c | 1 src/stubs/regfpefunc.c | 4 src/stubs/rmfshdl.c | 1 src/stubs/servclient.c | 9 + src/stubs/setfntauth.c | 1 src/stubs/stfntcfnt.c | 1 src/stubs/stubs.h | 49 +++++++ src/stubs/stubsinit.c | 82 ++++++++++++ src/util/atom.c | 4 src/util/miscutil.c | 12 + src/util/patcache.c | 14 +- 47 files changed, 637 insertions(+), 167 deletions(-)
New commits: commit b19cf2a78f7f721c43d0d9e2f32b71fc746142a3 Author: Alan Coopersmith <[email protected]> Date: Mon Jul 7 13:18:18 2014 -0700 libXfont 1.4.99.901 Signed-off-by: Alan Coopersmith <[email protected]> diff --git a/configure.ac b/configure.ac index 13fe3e1..d4320de 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([libXfont], [1.4.99.0], +AC_INIT([libXfont], [1.4.99.901], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXfont]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h include/X11/fonts/fontconf.h]) commit 0dcdd82059c69ec417bb094f4da2afef7cc1426a Author: Yaakov Selkowitz <[email protected]> Date: Sun Apr 6 14:18:32 2014 -0500 Make shared library work on Cygwin/MinGW Weak symbols on PE platforms do not work the same way as on ELF platforms, hence we have been unable to have a fully functional shared libXfont until now. This patch works around these issues so that we can fix that. In summary, only when compiling shared libraries on NO_WEAK_SYMBOLS platforms, when the first stub is called, the invoking program is first checked to determine if it exports the stubbed functions. Then, for every stub call, if the function is exported by the loader, it is called instead of the stub code. serverClient and serverGeneration are data pointers, and therefore are replaced by getter functions. ErrorF is variadic, so the override is routed through VErrorF instead. FatalError has no va_list equivalent, but it is not actually used in libXfont and therefore should be safe to remove. This requires all X servers to export their symbols, which requires forthcoming patches for hw/xwin and xfs; the other xservers (including tigervnc) already do this via LD_EXPORT_SYMBOLS_FLAG. Signed-off-by: Yaakov Selkowitz <[email protected]> Reviewed-by: Colin Harrison <[email protected]> Acked-by: Alan Coopersmith <[email protected]> Tested-by: Jeremy Huddleston Sequoia <[email protected]> diff --git a/src/Makefile.am b/src/Makefile.am index cd09ab9..33fd135 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -65,4 +65,4 @@ libXfont_la_LIBADD = \ libXfont_la_SOURCES = dummy.c -libXfont_la_LDFLAGS = -version-number 1:4:1 +libXfont_la_LDFLAGS = -version-number 1:4:1 -no-undefined diff --git a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c index b32639f..c9af4c0 100644 --- a/src/bitmap/bitscale.c +++ b/src/bitmap/bitscale.c @@ -44,7 +44,7 @@ from The Open Group. #endif /* Should get this from elsewhere */ -extern unsigned long serverGeneration; +extern unsigned long __GetServerGeneration(void); static void bitmapUnloadScalable (FontPtr pFont); static void ScaleBitmap ( FontPtr pFont, CharInfoPtr opci, @@ -581,9 +581,9 @@ ComputeScaledProperties(FontInfoPtr sourceFontInfo, /* the font to be scaled */ char *isStringProp; int nProps; - if (bitscaleGeneration != serverGeneration) { + if (bitscaleGeneration != __GetServerGeneration()) { initFontPropTable(); - bitscaleGeneration = serverGeneration; + bitscaleGeneration = __GetServerGeneration(); } nProps = NPROPS + 1 + sizeof(fontPropTable) / sizeof(fontProp) + sizeof(rawFontPropTable) / sizeof(fontProp); diff --git a/src/fc/fserve.c b/src/fc/fserve.c index c1cf9d6..92b0d53 100644 --- a/src/fc/fserve.c +++ b/src/fc/fserve.c @@ -2161,7 +2161,7 @@ fs_send_load_glyphs(pointer client, FontPtr pfont, } -extern pointer serverClient; /* This could be any number that +extern pointer __GetServerClient(void); /* This could be any number that doesn't conflict with existing client values. */ @@ -2333,17 +2333,17 @@ fs_load_all_glyphs(FontPtr pfont) * perform an unpleasant job that, we hope, will never be required. */ - while ((err = _fs_load_glyphs(serverClient, pfont, TRUE, 0, 0, NULL)) == + while ((err = _fs_load_glyphs(__GetServerClient(), pfont, TRUE, 0, 0, NULL)) == Suspended) { if (fs_await_reply (conn) != FSIO_READY) { /* Get rid of blockrec */ - fs_client_died(serverClient, pfont->fpe); + fs_client_died(__GetServerClient(), pfont->fpe); err = BadCharRange; break; } - fs_read_reply (pfont->fpe, serverClient); + fs_read_reply (pfont->fpe, __GetServerClient()); } return err; } diff --git a/src/fontfile/renderers.c b/src/fontfile/renderers.c index 5091922..bbcd466 100644 --- a/src/fontfile/renderers.c +++ b/src/fontfile/renderers.c @@ -40,7 +40,7 @@ static FontRenderersRec renderers; * XXX Maybe should allow unregistering renders. For now, just clear the * list at each new generation. */ -extern unsigned long serverGeneration; +extern unsigned long __GetServerGeneration(void); static unsigned long rendererGeneration = 0; Bool @@ -55,8 +55,8 @@ FontFilePriorityRegisterRenderer (FontRendererPtr renderer, int priority) int i; struct _FontRenderersElement *new; - if (rendererGeneration != serverGeneration) { - rendererGeneration = serverGeneration; + if (rendererGeneration != __GetServerGeneration()) { + rendererGeneration = __GetServerGeneration(); renderers.number = 0; if (renderers.renderers) free(renderers.renderers); diff --git a/src/stubs/Makefile.am b/src/stubs/Makefile.am index 23e3bd1..7eb16d4 100644 --- a/src/stubs/Makefile.am +++ b/src/stubs/Makefile.am @@ -10,7 +10,6 @@ libstubs_la_SOURCES = \ csignal.c \ delfntcid.c \ errorf.c \ - fatalerror.c \ findoldfnt.c \ getcres.c \ getdefptsize.c \ @@ -22,4 +21,5 @@ libstubs_la_SOURCES = \ servclient.c \ setfntauth.c \ stfntcfnt.c \ + stubsinit.c \ stubs.h diff --git a/src/stubs/cauthgen.c b/src/stubs/cauthgen.c index 026c52d..10086e4 100644 --- a/src/stubs/cauthgen.c +++ b/src/stubs/cauthgen.c @@ -10,5 +10,6 @@ weak int client_auth_generation(ClientPtr client) { + OVERRIDE_SYMBOL(client_auth_generation, client); return 0; } diff --git a/src/stubs/csignal.c b/src/stubs/csignal.c index e6fdeae..dd88b3d 100644 --- a/src/stubs/csignal.c +++ b/src/stubs/csignal.c @@ -10,5 +10,6 @@ weak Bool ClientSignal(ClientPtr client) { + OVERRIDE_SYMBOL(ClientSignal,client); return True; } diff --git a/src/stubs/delfntcid.c b/src/stubs/delfntcid.c index ca71328..8113b9f 100644 --- a/src/stubs/delfntcid.c +++ b/src/stubs/delfntcid.c @@ -10,4 +10,5 @@ weak void DeleteFontClientID(Font id) { + OVERRIDE_SYMBOL(DeleteFontClientID, id); } diff --git a/src/stubs/errorf.c b/src/stubs/errorf.c index fd32965..d2de6c6 100644 --- a/src/stubs/errorf.c +++ b/src/stubs/errorf.c @@ -10,4 +10,5 @@ weak void ErrorF(const char *f, ...) { + OVERRIDE_VA_SYMBOL(VErrorF, f); } diff --git a/src/stubs/fatalerror.c b/src/stubs/fatalerror.c deleted file mode 100644 index 1549ad3..0000000 --- a/src/stubs/fatalerror.c +++ /dev/null @@ -1,13 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include <config.h> -#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 7a00084..c73279e 100644 --- a/src/stubs/findoldfnt.c +++ b/src/stubs/findoldfnt.c @@ -10,5 +10,6 @@ weak FontPtr find_old_font(FSID id) { + OVERRIDE_SYMBOL(find_old_font, id); return (FontPtr)NULL; } diff --git a/src/stubs/getcres.c b/src/stubs/getcres.c index 0b98f46..27a9180 100644 --- a/src/stubs/getcres.c +++ b/src/stubs/getcres.c @@ -10,5 +10,6 @@ weak FontResolutionPtr GetClientResolutions(int *num) { + OVERRIDE_SYMBOL(GetClientResolutions, num); return (FontResolutionPtr) 0; } diff --git a/src/stubs/getdefptsize.c b/src/stubs/getdefptsize.c index 0b9e409..50c1b18 100644 --- a/src/stubs/getdefptsize.c +++ b/src/stubs/getdefptsize.c @@ -10,5 +10,6 @@ weak int GetDefaultPointSize(void) { + OVERRIDE_SYMBOL(GetDefaultPointSize); return 0; } diff --git a/src/stubs/getnewfntcid.c b/src/stubs/getnewfntcid.c index e2fe8bb..d31ccf1 100644 --- a/src/stubs/getnewfntcid.c +++ b/src/stubs/getnewfntcid.c @@ -10,5 +10,6 @@ weak Font GetNewFontClientID(void) { + OVERRIDE_SYMBOL(GetNewFontClientID); return (Font)0; } diff --git a/src/stubs/gettime.c b/src/stubs/gettime.c index 7b2d3b3..1b20f62 100644 --- a/src/stubs/gettime.c +++ b/src/stubs/gettime.c @@ -10,5 +10,6 @@ weak unsigned long GetTimeInMillis (void) { + OVERRIDE_SYMBOL(GetTimeInMillis); return 0; } diff --git a/src/stubs/initfshdl.c b/src/stubs/initfshdl.c index a14daff..e1c0b24 100644 --- a/src/stubs/initfshdl.c +++ b/src/stubs/initfshdl.c @@ -11,5 +11,6 @@ weak int init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler) { + OVERRIDE_SYMBOL(init_fs_handlers, fpe, block_handler); return Successful; } diff --git a/src/stubs/regfpefunc.c b/src/stubs/regfpefunc.c index fdf22cd..ae12a01 100644 --- a/src/stubs/regfpefunc.c +++ b/src/stubs/regfpefunc.c @@ -24,5 +24,9 @@ RegisterFPEFunctions(NameCheckFunc name_func, NextLaFunc next_list_alias_func, SetPathFunc set_path_func) { + OVERRIDE_SYMBOL(RegisterFPEFunctions, name_func, init_func, free_func, + reset_func, open_func, close_func, list_func, start_lfwi_func, + next_lfwi_func, wakeup_func, client_died, load_glyphs, + start_list_alias_func, next_list_alias_func, set_path_func); return 0; } diff --git a/src/stubs/rmfshdl.c b/src/stubs/rmfshdl.c index b495661..22a3091 100644 --- a/src/stubs/rmfshdl.c +++ b/src/stubs/rmfshdl.c @@ -12,4 +12,5 @@ remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr blockHandler, Bool all) { + OVERRIDE_SYMBOL(remove_fs_handlers, fpe, blockHandler, all); } diff --git a/src/stubs/servclient.c b/src/stubs/servclient.c index 9b6cebb..f85e08e 100644 --- a/src/stubs/servclient.c +++ b/src/stubs/servclient.c @@ -8,3 +8,12 @@ #endif weak void *serverClient = 0; + +void *__GetServerClient(void); + +void * +__GetServerClient(void) +{ + OVERRIDE_DATA(serverClient); + return serverClient; +} diff --git a/src/stubs/setfntauth.c b/src/stubs/setfntauth.c index 0c7eccc..371807e 100644 --- a/src/stubs/setfntauth.c +++ b/src/stubs/setfntauth.c @@ -10,5 +10,6 @@ weak int set_font_authorizations(char **authorizations, int *authlen, ClientPtr client) { + OVERRIDE_SYMBOL(set_font_authorizations, authorizations, authlen, client); return 0; } diff --git a/src/stubs/stfntcfnt.c b/src/stubs/stfntcfnt.c index 5fc1745..d490988 100644 --- a/src/stubs/stfntcfnt.c +++ b/src/stubs/stfntcfnt.c @@ -10,5 +10,6 @@ weak int StoreFontClientFont(FontPtr pfont, Font id) { + OVERRIDE_SYMBOL(StoreFontClientFont, pfont, id); return 0; } diff --git a/src/stubs/stubs.h b/src/stubs/stubs.h index fa634e9..7d499d5 100644 --- a/src/stubs/stubs.h +++ b/src/stubs/stubs.h @@ -19,6 +19,54 @@ #endif #endif +#if defined(NO_WEAK_SYMBOLS) && defined(PIC) +#include <stdarg.h> +extern int _font_init_stubs(void); +#define OVERRIDE_DATA(sym) \ + _font_init_stubs(); \ + if (__ptr_##sym && __ptr_##sym != &sym) \ + sym = *__ptr_##sym +#define OVERRIDE_SYMBOL(sym,...) \ + _font_init_stubs(); \ + if (__##sym && __##sym != sym) \ + return (*__##sym)(__VA_ARGS__) +#define OVERRIDE_VA_SYMBOL(sym,f) \ + va_list _args; \ + _font_init_stubs(); \ + va_start(_args, f); \ + if (__##sym) \ + (*__##sym)(f, _args); \ + va_end(_args) + +int (*__client_auth_generation)(ClientPtr); +Bool (*__ClientSignal)(ClientPtr); +void (*__DeleteFontClientID)(Font); +void (*__VErrorF)(const char *, va_list); +FontPtr (*__find_old_font)(FSID); +FontResolutionPtr (*__GetClientResolutions)(int *); +int (*__GetDefaultPointSize)(void); +Font (*__GetNewFontClientID)(void); +unsigned long (*__GetTimeInMillis)(void); +int (*__init_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr); +int (*__RegisterFPEFunctions)(NameCheckFunc, InitFpeFunc, FreeFpeFunc, + ResetFpeFunc, OpenFontFunc, CloseFontFunc, ListFontsFunc, + StartLfwiFunc, NextLfwiFunc, WakeupFpeFunc, ClientDiedFunc, + LoadGlyphsFunc, StartLaFunc, NextLaFunc, SetPathFunc); +void (*__remove_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr, Bool); +void **__ptr_serverClient; +int (*__set_font_authorizations)(char **, int *, ClientPtr); +int (*__StoreFontClientFont)(FontPtr, Font); +Atom (*__MakeAtom)(const char *, unsigned, int); +int (*__ValidAtom)(Atom); +char *(*__NameForAtom)(Atom); +unsigned long *__ptr_serverGeneration; +void (*__register_fpe_functions)(void); +#else /* NO_WEAK_SYMBOLS && PIC */ +#define OVERRIDE_DATA(sym) +#define OVERRIDE_SYMBOL(sym,...) +#define OVERRIDE_VA_SYMBOL(sym,f) +#endif + /* This is really just a hack for now... __APPLE__ really should be using * the weak symbols route above, but it's causing an as-yet unresolved issue, * so we're instead building with flat_namespace. @@ -36,6 +84,5 @@ extern int set_font_authorizations ( char **authorizations, extern unsigned long GetTimeInMillis (void); extern void ErrorF(const char *format, ...); -extern void FatalError(const char *format, ...); /* end of file */ diff --git a/src/stubs/stubsinit.c b/src/stubs/stubsinit.c new file mode 100644 index 0000000..fc52332 --- /dev/null +++ b/src/stubs/stubsinit.c @@ -0,0 +1,82 @@ +#include "stubs.h" + +#if defined(NO_WEAK_SYMBOLS) && defined(PIC) + +#ifdef WIN32 +#include <X11/Xwindows.h> +#define DLOPEN_SELF() GetModuleHandle(NULL) +#define DLSYM(h,f) GetProcAddress(h,f) +#else +#include <dlfcn.h> +#define DLOPEN_SELF() dlopen(NULL, RTLD_LOCAL) +#define DLSYM(h,f) dlsym(h, f) +#endif + +int (*__client_auth_generation)(ClientPtr) = NULL; +Bool (*__ClientSignal)(ClientPtr) = NULL; +void (*__DeleteFontClientID)(Font) = NULL; +void (*__VErrorF)(const char *, va_list) = NULL; +FontPtr (*__find_old_font)(FSID) = NULL; +FontResolutionPtr (*__GetClientResolutions)(int *) = NULL; +int (*__GetDefaultPointSize)(void) = NULL; +Font (*__GetNewFontClientID)(void) = NULL; +unsigned long (*__GetTimeInMillis)(void) = NULL; +int (*__init_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr) = NULL; +int (*__RegisterFPEFunctions)(NameCheckFunc, InitFpeFunc, FreeFpeFunc, + ResetFpeFunc, OpenFontFunc, CloseFontFunc, ListFontsFunc, + StartLfwiFunc, NextLfwiFunc, WakeupFpeFunc, ClientDiedFunc, + LoadGlyphsFunc, StartLaFunc, NextLaFunc, SetPathFunc) = NULL; +void (*__remove_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr, Bool) = NULL; +void **__ptr_serverClient = NULL; +int (*__set_font_authorizations)(char **, int *, ClientPtr) = NULL; +int (*__StoreFontClientFont)(FontPtr, Font) = NULL; +Atom (*__MakeAtom)(const char *, unsigned, int) = NULL; +int (*__ValidAtom)(Atom) = NULL; +char *(*__NameForAtom)(Atom) = NULL; +unsigned long *__ptr_serverGeneration = NULL; +void (*__register_fpe_functions)(void) = NULL; + +#define INIT_SYMBOL(sym) \ + if (!__##sym) \ + __##sym = (typeof(__##sym)) DLSYM(handle, #sym) +#define INIT_DATA(sym) \ + if (!__ptr_##sym) \ + __ptr_##sym = (typeof(__ptr_##sym)) DLSYM(handle, #sym) + +int +_font_init_stubs (void) +{ + static int inited = FALSE; + static void *handle = NULL; + + if (inited) + return inited; + if (!handle) + handle = DLOPEN_SELF(); + + INIT_SYMBOL(client_auth_generation); + INIT_SYMBOL(ClientSignal); + INIT_SYMBOL(DeleteFontClientID); + INIT_SYMBOL(VErrorF); + INIT_SYMBOL(find_old_font); + INIT_SYMBOL(GetClientResolutions); + INIT_SYMBOL(GetDefaultPointSize); + INIT_SYMBOL(GetNewFontClientID); + INIT_SYMBOL(GetTimeInMillis); + INIT_SYMBOL(init_fs_handlers); + INIT_SYMBOL(RegisterFPEFunctions); + INIT_SYMBOL(remove_fs_handlers); + INIT_SYMBOL(set_font_authorizations); + INIT_SYMBOL(StoreFontClientFont); + INIT_SYMBOL(MakeAtom); + INIT_SYMBOL(ValidAtom); + INIT_SYMBOL(NameForAtom); + INIT_SYMBOL(register_fpe_functions); + INIT_DATA(serverClient); + INIT_DATA(serverGeneration); + + inited = TRUE; + return inited; +} + +#endif /* NO_WEAK_SYMBOLS && PIC */ diff --git a/src/util/atom.c b/src/util/atom.c index 37811f9..5f7f1c6 100644 --- a/src/util/atom.c +++ b/src/util/atom.c @@ -158,6 +158,8 @@ MakeAtom(const char *string, unsigned len, int makeit) int h = 0; int r; + OVERRIDE_SYMBOL(MakeAtom, string, len, makeit); + hash = Hash (string, len); if (hashTable) { @@ -230,6 +232,7 @@ MakeAtom(const char *string, unsigned len, int makeit) weak int ValidAtom(Atom atom) { + OVERRIDE_SYMBOL(ValidAtom, atom); return (atom != None) && (atom <= lastAtom); } @@ -240,6 +243,7 @@ ValidAtom(Atom atom) weak char * NameForAtom(Atom atom) { + OVERRIDE_SYMBOL(NameForAtom, atom); if (atom != None && atom <= lastAtom) return reverseMap[atom]->name; return NULL; diff --git a/src/util/miscutil.c b/src/util/miscutil.c index 3d802d2..61c9d11 100644 --- a/src/util/miscutil.c +++ b/src/util/miscutil.c @@ -45,14 +45,22 @@ from The Open Group. extern void BuiltinRegisterFpeFunctions(void); -#ifndef NO_WEAK_SYMBOLS /* make sure everything initializes themselves at least once */ weak unsigned long serverGeneration = 1; -#endif + +unsigned long __GetServerGeneration (void); + +unsigned long +__GetServerGeneration (void) +{ + OVERRIDE_DATA(serverGeneration); + return serverGeneration; +} weak void register_fpe_functions (void) { + OVERRIDE_SYMBOL(register_fpe_functions); BuiltinRegisterFpeFunctions(); FontFileRegisterFpeFunctions(); #ifdef XFONT_FC commit 783a406d6258509abfbdc54c0b32366dcaf13044 Author: Keith Packard <[email protected]> Date: Mon Apr 21 13:37:00 2014 -0700 Use default glyphs when getting 16-bit font with 8-bit text When accessing a 16-bit font with firstRow > 0 with 8-bit text, check to see if the font has a default character and return that for every incoming character. Signed-off-by: Keith Packard <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Alan Coopersmith <[email protected]> diff --git a/src/bitmap/bitmap.c b/src/bitmap/bitmap.c index 9b20faf..0a379eb 100644 --- a/src/bitmap/bitmap.c +++ b/src/bitmap/bitmap.c @@ -63,8 +63,12 @@ bitmapGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars, case Linear8Bit: case TwoD8Bit: - if (pFont->info.firstRow > 0) + if (pFont->info.firstRow > 0) { + if (pDefault) + while (count--) + *glyphs++ = pDefault; break; + } if (pFont->info.allExist && pDefault) { while (count--) { c = (*chars++) - firstCol; commit e8d20171fe04dbdc5f97739d5a59e02f0b091ba0 Author: Alan Coopersmith <[email protected]> Date: Thu May 15 23:04:23 2014 -0700 Don't build unused code in bitmapfunc.c if all bitmap formats are disabled If the only bitmaps we support are builtins, don't need the code to register all the bitmap font file handlers. Fixes gcc warnings: bitmapfunc.c:110:1: warning: 'BitmapOpenBitmap' defined but not used [-Wunused-function] BitmapOpenBitmap (FontPathElementPtr fpe, FontPtr *ppFont, int flags, ^ bitmapfunc.c:155:1: warning: 'BitmapGetInfoBitmap' defined but not used [-Wunused-function] BitmapGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo, ^ Signed-off-by: Alan Coopersmith <[email protected]> Reviewed-by: Rémi Cardona <[email protected]> diff --git a/src/bitmap/bitmapfunc.c b/src/bitmap/bitmapfunc.c index d942b42..8c6b3d8 100644 --- a/src/bitmap/bitmapfunc.c +++ b/src/bitmap/bitmapfunc.c @@ -35,10 +35,17 @@ in this Software without prior written authorization from The Open Group. #include <X11/fonts/fntfilst.h> #include <X11/fonts/bitmap.h> #include <X11/fonts/fontutil.h> +#if XFONT_BDFFORMAT #include <X11/fonts/bdfint.h> +#endif +#if XFONT_PCFFORMAT #include <X11/fonts/pcf.h> +#endif +#if XFONT_SNFFORMAT #include "snfstr.h" +#endif +#if XFONT_PCFFORMAT || XFONT_SNFFORMAT || XFONT_BDFFORMAT typedef struct _BitmapFileFunctions { int (*ReadFont) (FontPtr /* pFont */, FontFilePtr /* file */, int /* bit */, int /* byte */, @@ -236,3 +243,11 @@ BitmapGetRenderIndex(FontRendererPtr renderer) { return renderer - renderers; } + +#else +void +BitmapRegisterFontFileFunctions (void) +{ + /* nothing to do */ +} +#endif /* XFONT_PCFFORMAT || XFONT_SNFFORMAT || XFONT_BDFFORMAT */ commit c2b7758d268fd98e09c3e66a0e7717b47ff12a47 Author: Alan Coopersmith <[email protected]> Date: Thu May 15 22:44:38 2014 -0700 Don't compile bitmap source files for disabled formats pcfread.c is a special case - it's needed for either reading pcf files from disk (--enable-pcfformat) or from the builtin fonts in memory (--enable-builtins), so needed a new AM_CONDITIONAL case. Signed-off-by: Alan Coopersmith <[email protected]> Reviewed-by: Rémi Cardona <[email protected]> diff --git a/configure.ac b/configure.ac index 30f4d6d..13fe3e1 100644 --- a/configure.ac +++ b/configure.ac @@ -153,6 +153,9 @@ if test "x$XFONT_PCFFORMAT" = xyes; then XFONT_BITMAP=yes fi +AM_CONDITIONAL(XFONT_PCF_OR_BUILTIN, + [test "x$XFONT_PCFFORMAT" = xyes -o "x$XFONT_BUILTINS" = xyes]) + AC_ARG_ENABLE(bdfformat, AS_HELP_STRING([--disable-bdfformat], [Support BDF format bitmap fonts (default: enabled)]), diff --git a/src/bitmap/Makefile.am b/src/bitmap/Makefile.am index 99682d9..0f2d10a 100644 --- a/src/bitmap/Makefile.am +++ b/src/bitmap/Makefile.am @@ -6,14 +6,24 @@ AM_CFLAGS = $(XFONT_CFLAGS) $(OS_CFLAGS) $(CWARNFLAGS) noinst_LTLIBRARIES = libbitmap.la libbitmap_la_SOURCES = \ - bdfread.c \ - bdfutils.c \ bitmap.c \ bitmapfunc.c \ bitmaputil.c \ bitscale.c \ - fontink.c \ - pcfread.c \ - pcfwrite.c \ - snfread.c \ - snfstr.h + fontink.c + +if XFONT_BDFFORMAT +libbitmap_la_SOURCES += bdfread.c bdfutils.c +endif + +if XFONT_PCF_OR_BUILTIN +libbitmap_la_SOURCES += pcfread.c +endif + +if XFONT_PCFFORMAT +libbitmap_la_SOURCES += pcfwrite.c +endif + +if XFONT_SNFFORMAT +libbitmap_la_SOURCES += snfread.c snfstr.h +endif commit a81f1a9bd3cd0a9d45d93d5b9e392b4e08ac60f7 Author: Alan Coopersmith <[email protected]> Date: Thu May 15 20:43:34 2014 -0700 Drop imake/monolithic compatibility #define mapping Require the #defines from configure.ac now that we're not sharing source with the imake builds any longer. Signed-off-by: Alan Coopersmith <[email protected]> Reviewed-by: Rémi Cardona <[email protected]> diff --git a/src/bitmap/bitmapfunc.c b/src/bitmap/bitmapfunc.c index 603d5d9..d942b42 100644 --- a/src/bitmap/bitmapfunc.c +++ b/src/bitmap/bitmapfunc.c @@ -32,22 +32,6 @@ in this Software without prior written authorization from The Open Group. #include <config.h> #endif -/* - * Translate monolithic #defines to modular definitions - */ - -#ifdef PCFFORMAT -#define XFONT_PCFFORMAT 1 -#endif - -#ifdef SNFFORMAT -#define XFONT_SNFFORMAT 1 -#endif - -#ifdef BDFFORMAT -#define XFONT_BDFFORMAT 1 -#endif - #include <X11/fonts/fntfilst.h> #include <X11/fonts/bitmap.h> #include <X11/fonts/fontutil.h> diff --git a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c index b864a28..b32639f 100644 --- a/src/bitmap/bitscale.c +++ b/src/bitmap/bitscale.c @@ -34,22 +34,6 @@ from The Open Group. #include <config.h> #endif -/* - * Translate monolithic #defines to modular definitions - */ - -#ifdef PCFFORMAT -#define XFONT_PCFFORMAT 1 -#endif - -#ifdef SNFFORMAT -#define XFONT_SNFFORMAT 1 -#endif - -#ifdef BDFFORMAT -#define XFONT_BDFFORMAT 1 -#endif - #include <X11/fonts/fntfilst.h> #include <X11/fonts/bitmap.h> #include <X11/fonts/fontutil.h> commit 37595cfd4feaf031552d66f96dc6d58686f9c851 Author: Alan Coopersmith <[email protected]> Date: Thu May 15 20:26:41 2014 -0700 Change default to disabling SNF support Signed-off-by: Alan Coopersmith <[email protected]> Reviewed-by: Rémi Cardona <[email protected]> diff --git a/README b/README index 65f1aa4..c95c3cf 100644 --- a/README +++ b/README @@ -43,9 +43,9 @@ configure script takes various options to enable or disable them: snf bitmap fonts - standard bitmap font format prior to X11R5 in 1991, remains only for backwards compatibility. Unlike pcf, snf files are architecture specific, and contain less font information - than pcf files. snf fonts are deprecated and may be disabled - by default in future libXfont releases. - Enabled by default, disable via --disable-snfformat. + than pcf files. snf fonts are deprecated and support for them + may be removed in future libXfont releases. + Disabled by default, enable via --disable-snfformat. -- Font services: diff --git a/configure.ac b/configure.ac index 4edad6d..30f4d6d 100644 --- a/configure.ac +++ b/configure.ac @@ -164,9 +164,9 @@ if test "x$XFONT_BDFFORMAT" = xyes; then fi AC_ARG_ENABLE(snfformat, - AS_HELP_STRING([--disable-snfformat], - [Support SNF format bitmap fonts (default: enabled)]), - [XFONT_SNFFORMAT=$enableval], [XFONT_SNFFORMAT=yes]) + AS_HELP_STRING([--enable-snfformat], + [Support SNF format bitmap fonts (default: disabled)]), + [XFONT_SNFFORMAT=$enableval], [XFONT_SNFFORMAT=no]) AM_CONDITIONAL(XFONT_SNFFORMAT, [test "x$XFONT_SNFFORMAT" = xyes]) if test "x$XFONT_SNFFORMAT" = xyes; then AC_DEFINE(XFONT_SNFFORMAT,1,[Support snf format bitmap font files]) commit 9f677e55c7bf07df280427f127af21e5b70f1e03 Author: Alan Coopersmith <[email protected]> Date: Thu May 15 20:21:29 2014 -0700 Use AS_HELP_STRING to provide help for AC_ARG_ENABLE & AC_ARG_WITH options Signed-off-by: Alan Coopersmith <[email protected]> Reviewed-by: Rémi Cardona <[email protected]> diff --git a/configure.ac b/configure.ac index 89b34ce..4edad6d 100644 --- a/configure.ac +++ b/configure.ac @@ -67,11 +67,17 @@ XFONT_FONTFILE=no # FreeType for all scalable (OpenType, TrueType, PostScript) and # some bitmap formats (BDF & PCF) # -AC_ARG_ENABLE(freetype, [ --disable-freetype],[XFONT_FREETYPE=$enableval],[XFONT_FREETYPE=yes]) +AC_ARG_ENABLE(freetype, + AS_HELP_STRING([--disable-freetype], + [Build freetype backend (default: enabled)]), + [XFONT_FREETYPE=$enableval],[XFONT_FREETYPE=yes]) AM_CONDITIONAL(XFONT_FREETYPE, [test x$XFONT_FREETYPE = xyes]) if test x$XFONT_FREETYPE = xyes; then AC_DEFINE(XFONT_FREETYPE,1,[Support FreeType rasterizer for nearly all font file formats]) - AC_ARG_WITH(freetype-config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=auto) + AC_ARG_WITH(freetype-config, + AS_HELP_STRING([--with-freetype-config=PROG], + [Use FreeType configuration program PROG]), + [freetype_config=$withval], [freetype_config=auto]) if test "$freetype_config" = "auto" ; then PKG_CHECK_MODULES(FREETYPE, freetype2, @@ -117,7 +123,7 @@ AC_CHECK_LIB(z, gzopen, [Z_LIBS=-lz], AC_MSG_ERROR([*** zlib is required])) AC_ARG_WITH(bzip2, AS_HELP_STRING([--with-bzip2], - [Support bzip2 compressed bitmap fonts]), + [Use libbz2 to support bzip2 compressed bitmap fonts (default: no)]), [], [with_bzip2=no]) if test "x$with_bzip2" = xyes; then AC_CHECK_LIB(bz2, BZ2_bzopen, [Z_LIBS="$Z_LIBS -lbz2"], @@ -127,28 +133,40 @@ fi AM_CONDITIONAL(X_BZIP2_FONT_COMPRESSION, [test "x$with_bzip2" = xyes ]) AC_SUBST(Z_LIBS) -AC_ARG_ENABLE(builtins, [ --disable-builtins ], [XFONT_BUILTINS=$enableval], [XFONT_BUILTINS=yes]) +AC_ARG_ENABLE(builtins, + AS_HELP_STRING([--disable-builtins], + [Support builtin fonts (default: enabled)]), + [XFONT_BUILTINS=$enableval], [XFONT_BUILTINS=yes]) AM_CONDITIONAL(XFONT_BUILTINS, [test "x$XFONT_BUILTINS" = xyes ]) if test "x$XFONT_BUILTINS" = xyes; then AC_DEFINE(XFONT_BUILTINS,1,[Support built-in fonts]) XFONT_BITMAP=yes fi -AC_ARG_ENABLE(pcfformat, [ --disable-pcfformat ], [XFONT_PCFFORMAT=$enableval], [XFONT_PCFFORMAT=yes]) +AC_ARG_ENABLE(pcfformat, + AS_HELP_STRING([--disable-pcfformat], + [Support PCF format bitmap fonts (default: enabled)]), + [XFONT_PCFFORMAT=$enableval], [XFONT_PCFFORMAT=yes]) AM_CONDITIONAL(XFONT_PCFFORMAT, [test "x$XFONT_PCFFORMAT" = xyes]) if test "x$XFONT_PCFFORMAT" = xyes; then AC_DEFINE(XFONT_PCFFORMAT,1,[Support pcf format bitmap font files]) XFONT_BITMAP=yes fi -AC_ARG_ENABLE(bdfformat, [ --disable-bdfformat ], [XFONT_BDFFORMAT=$enableval], [XFONT_BDFFORMAT=yes]) +AC_ARG_ENABLE(bdfformat, + AS_HELP_STRING([--disable-bdfformat], + [Support BDF format bitmap fonts (default: enabled)]), + [XFONT_BDFFORMAT=$enableval], [XFONT_BDFFORMAT=yes]) AM_CONDITIONAL(XFONT_BDFFORMAT, [test "x$XFONT_BDFFORMAT" = xyes]) if test "x$XFONT_BDFFORMAT" = xyes; then AC_DEFINE(XFONT_BDFFORMAT,1,[Support bdf format bitmap font files]) XFONT_BITMAP=yes fi -AC_ARG_ENABLE(snfformat, [ --disable-snfformat ], [XFONT_SNFFORMAT=$enableval], [XFONT_SNFFORMAT=yes]) +AC_ARG_ENABLE(snfformat, + AS_HELP_STRING([--disable-snfformat], + [Support SNF format bitmap fonts (default: enabled)]), + [XFONT_SNFFORMAT=$enableval], [XFONT_SNFFORMAT=yes]) AM_CONDITIONAL(XFONT_SNFFORMAT, [test "x$XFONT_SNFFORMAT" = xyes]) if test "x$XFONT_SNFFORMAT" = xyes; then AC_DEFINE(XFONT_SNFFORMAT,1,[Support snf format bitmap font files]) @@ -170,7 +188,10 @@ fi # Support connection to font servers? # -AC_ARG_ENABLE(fc, [ --disable-fc ],[XFONT_FC=$enableval],[XFONT_FC=yes]) +AC_ARG_ENABLE(fc, + AS_HELP_STRING([--disable-fc], + [Support connections to xfs servers (default: enabled)]), + [XFONT_FC=$enableval],[XFONT_FC=yes]) AM_CONDITIONAL(XFONT_FC, [test "x$XFONT_FC" = xyes]) if test "x$XFONT_FC" = xyes; then AC_DEFINE(XFONT_FC,1,[Support the X Font Services Protocol]) commit d338f81df1e188eb16e1d6aeea7f4800f89c1218 Author: Alan Coopersmith <[email protected]> Date: Fri May 2 19:24:17 2014 -0700 CVE-2014-0210: unvalidated length fields in fs_read_list_info() fs_read_list_info() parses a reply from the font server. The reply contains a number of additional data items with embedded length or count fields, none of which are validated. This can cause out of bound reads when looping over these items in the reply. Signed-off-by: Alan Coopersmith <[email protected]> diff --git a/src/fc/fserve.c b/src/fc/fserve.c index 4dcdc04..c1cf9d6 100644 --- a/src/fc/fserve.c +++ b/src/fc/fserve.c @@ -2491,6 +2491,7 @@ fs_read_list_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) FSBlockedListInfoPtr binfo = (FSBlockedListInfoPtr) blockrec->data; -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: https://lists.debian.org/[email protected]

