summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Set close-on-exec when opening fonts.dir & fonts.alias filesHEADmasterAlan Coopersmith2023-03-251-2/+6
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* configure: Use LT_INIT from libtool 2 instead of deprecated AC_PROG_LIBTOOLAlan Coopersmith2023-03-041-2/+3
| | | | | | | | | | | | | | | | | AC_PROG_LIBTOOL was replaced by LT_INIT in libtool 2 in 2008, so it's time to rely on it. Clears autoconf warnings: configure.ac:38: warning: The macro `AC_PROG_LIBTOOL' is obsolete. configure.ac:38: You should run autoupdate. aclocal.m4:3640: AC_PROG_LIBTOOL is expanded from... configure.ac:38: the top level libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac, libtoolize: and rerunning libtoolize and aclocal. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove "All rights reserved" from Oracle copyright noticesAlan Coopersmith2023-02-256-6/+6
| | | | | | Oracle no longer includes this term in our copyright & license notices. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* configure: raise minimum autoconf requirement to 2.70Alan Coopersmith2023-02-162-5/+6
| | | | | | | | Needed for builds on NetBSD to work correctly, since it depends on AC_USE_SYSTEM_EXTENSIONS defining _OPENBSD_SOURCE to expose the prototype for reallocarray() in the system headers. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* atom: Update Hash() to be unsignedJeremy Huddleston Sequoia2022-11-261-18/+16
| | | | | | This avoids undefined behavior (left shift overflow in signed integer type) Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* Fix font server reconnection timeoutPeter Harris2022-11-101-0/+2
| | | | | | | | | | | | | | | The great libxfont2 rewrite 135fb032e940ce226c9feb13e6e903f3ecbc5eb0 split fs_wakeup into fs_wakeup and fs_fd_handler. The fs_fd_handler side is called when there is new data on the socket. The fs_wakeup side is called on a timeout. If there's a connection timeout, the block handler will set the timeout to zero, expecting fs_wakeup to handle the timeout. Therefore, we need to call _fs_check_reconnect in fs_wakeup to handle the connection timeout. If we don't, the X server will go to 100% CPU (and the font server connection will not be retried). Signed-off-by: Peter Harris <pharris@opentext.com>
* Only link with libbsd if needed for reallocarray() or strlcat()Alan Coopersmith2022-11-051-3/+9
| | | | | | | Avoid unnecessary library dependency when using a libc with these functions included Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Switch from libbsd to libbsd-overlayGuillem Jover2022-10-062-15/+6
| | | | | | | | This is the preferred usage form for libbsd, as it makes the code more portable and requires no special includes for libbsd, by transparently injects the needed standard headers that would be used on a BSD. Signed-off-by: Guillem Jover <guillem@hadrons.org>
* libXfont2 2.0.6libXfont2-2.0.6Alan Coopersmith2022-08-261-2/+2
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Fix buffer overrun in FontFileMakeDir on WIN32Peter Harris2022-08-111-4/+5
| | | | | | | | | | | When dirName is "" (eg. when called by BuiltinReadDirectory), FontFileMakeDir would read after the string when WIN32 is defined. Fix the overrun issue by checking the location of the found : before adding two. Signed-off-by: Peter Harris <pharris@opentext.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Fix comments to reflect removal of OS/2 supportAlan Coopersmith2022-06-213-4/+4
| | | | | | | Commit 6c29007756301 removed OS/2 support from the code, but missed updating the comments to match. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Correct fsCreateACReq lengthJeremy Huddleston Sequoia2022-06-211-1/+1
| | | | | | Regressed-in: 6972ea08ee5b2ef1cfbdc2fcaf14f06bbd391561 Fixes: https://gitlab.freedesktop.org/xorg/lib/libxfont/-/issues/13 Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* configure: Use pkg-config to handle zlib dependency if possibleAlan Coopersmith2022-06-203-3/+8
| | | | | | Preserves fallback for systems like darwin without zlib.pc Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Fix spelling/wording issuesAlan Coopersmith2022-04-0611-16/+16
| | | | | | | Found by using: codespell --builtin clear,rare,usage,informal,code,names Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Build xz tarballs instead of bzip2Alan Coopersmith2022-04-061-1/+1
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* gitlab CI: add a basic build testAlan Coopersmith2022-04-061-0/+99
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* libXfont2 2.0.5libXfont2-2.0.5Alan Coopersmith2021-08-011-1/+1
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Fix out-of-bounds read in FontFileMakeDir()Alex Richardson2021-07-141-4/+1
| | | | | | | BuiltinReadDirectory() calls FontFileMakeDir ("", builtin_dir_count); and this causes the `dirName[dirlen - 1]` access to read before the start of the string. I found this while porting Xvnc to CHERI-RISC-V (which has bounds and permissions on all pointers).
* configure: define HAVE_LIBBSD when libbsd was foundBernd Kuhls2021-06-121-0/+3
|
* Fix use after free when font server connection lostPeter Harris2021-03-021-21/+19
| | | | | | | | | | | | | | If there are multiple blocks waiting for the same font, only one of them will have ->freeFont set. The rest will be in a state of FS_DEPENDING. If the font server dies before the font finishes opening, the block with ->freeFont set will call ->unload_font, invalidating the pfont pointers in the remaining FS_DEPENDING blocks. Avoid a use after free (and potential crash) by passing conn to fs_cleanup_font instead of dereferencing pfont to find the conn. Signed-off-by: Peter Harris <pharris@opentext.com>
* Fix crash when font server connection lostPeter Harris2020-03-061-10/+10
| | | | | | | | | | | Always initialize the return value of fs_new_block_rec. Even if the conn->blockState is FS_BROKEN_CONNECTION | FS_RECONNECTING, we must not return with an uninitialized blockrec on the block list. When the blockrec times out, _fs_clean_aborted_blockrec calls fs_cleanup_bfont, which will try to follow pointers in the blockrec (which has not been initialized). Signed-off-by: Peter Harris <pharris@opentext.com>
* Fix Win32 build since c4ed2e06 "Add some unit testing utilities"Jon Turney2019-10-255-1/+55
| | | | Provide Win32 replacements for realpath() and err.h
* README: Remove mention of libXfont 1.5Adam Jackson2019-09-161-9/+4
| | | | | | xfs was ported to libXfont2 in release 1.2, and bdftopcf 1.1 includes a copy of enough of the old libXfont1 code to not need an external libXfont at all.
* libXfont2 2.0.4libXfont2-2.0.4Alan Coopersmith2019-09-141-1/+1
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Add src/util/replace.h to noinst_HEADERS so it gets included in tarballsAlan Coopersmith2019-09-141-1/+2
| | | | | | Found when "make distcheck" failed. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* fs_read_glyphs: check if rep is null before dereferencingAlan Coopersmith2019-08-171-1/+2
| | | | | | | Resolves coverity warning def16 from the list in https://gitlab.freedesktop.org/xorg/lib/libxfont/issues/6 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* CatalogueRescan: if opendir() fails, unref fpes, but don't free the catAlan Coopersmith2019-08-171-4/+2
| | | | | | | | | | | None of the callers of CatalogueRescan check for failure before accessing the cat pointer so don't free it (especially without clearing the pointer to it in fpe->private), just unref the contents. Can only be triggered if somehow stat() succeeds on the directory, but opendir fails anyway (removed between the calls? permission problem?). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* ComputeScaledProperties: check for valid pointers before making atomsAlan Coopersmith2019-08-171-2/+4
| | | | | | | Resolves coverity warning def23 from the list in https://gitlab.freedesktop.org/xorg/lib/libxfont/issues/6 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* stubs/atom.c: check for ResizeHashTable failureAlan Coopersmith2019-08-171-1/+3
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Fix whitespaceMaya Rashish2019-08-171-1/+1
|
* fontxlfd.c: tell gcc that switch fallthrough is intentionalAlan Coopersmith2019-08-041-0/+1
| | | | | | | | | | | | | Quiets: src/util/fontxlfd.c: In function ‘FontParseXLFDName’: src/util/fontxlfd.c:450:14: warning: this statement may fall through [-Wimplicit-fallthrough=] replaceChar = '*'; ~~~~~~~~~~~~^~~~~ src/util/fontxlfd.c:451:5: note: here case FONT_XLFD_REPLACE_ZERO: ^~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Convert multiplying malloc calls to use mallocarray insteadAlan Coopersmith2019-08-0414-28/+39
| | | | | | | Introduces mallocarray as a macro calling reallocarray with a NULL pointer for the old allocation. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Convert multiplying realloc calls to use reallocarray insteadAlan Coopersmith2019-08-0312-14/+25
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Add reallocarray fallback if not provided by libc nor libbsdAlan Coopersmith2019-08-033-1/+54
| | | | | | Implementation copied from the Xserver Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Use bounds checking string functions everywhereAlan Coopersmith2019-08-038-102/+131
| | | | | | | | Replace strcpy, strcat, sprintf with strlcpy, strlcat, snprintf everywhere, even where there were already bounds checks in place, to reduce time spent checking static analysis results. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Add strlcat & strlcpy fallbacks if not provided by libc nor libbsdAlan Coopersmith2019-08-035-1/+162
| | | | | | Implementations copied from the Xserver Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Add some unit testing utilitiesAlan Coopersmith2019-08-035-0/+487
| | | | | | | | | | | The test/utils directory contains some standalone test programs for testing libXfont funtionality without needing a full X server session. They could be used to generate automated unit testing in the future, but that work has not yet been done. [v2: updated original work from libXfont 1.5 to 2.0 API & makefiles] Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* fontfile: Remove unused 'bc' slot from _FontEntryAdam Jackson2019-05-142-9/+0
| | | | | | | | Whatever this is, we're not using it. On my machine we allocate about 1100 of these structs, and this change reduces the struct from 152 to 48 bytes, so this saves about 100k of memory. Signed-off-by: Adam Jackson <ajax@redhat.com>
* Update configure.ac bug URL for gitlab migrationAlan Coopersmith2019-03-161-1/+1
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Update README for gitlab migrationAlan Coopersmith2018-11-193-90/+91
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* avoid -Wformat errors from clang when building with -DDEBUGRin Okuyama2018-03-241-16/+16
| | | | | | | https://bugs.freedesktop.org/show_bug.cgi?id=99882 Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* libXfont2 2.0.3libXfont2-2.0.3Matthieu Herrb2017-11-251-1/+1
| | | | Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
* Open files with O_NOFOLLOW. (CVE-2017-16611)Michal Srb2017-11-252-4/+26
| | | | | | | | | A non-privileged X client can instruct X server running under root to open any file by creating own directory with "fonts.dir", "fonts.alias" or any font file being a symbolic link to any other file in the system. X server will then open it. This can be issue with special files such as /dev/watchdog. Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
* libXfont 2.0.2libXfont2-2.0.2Adam Jackson2017-10-111-1/+1
| | | | Signed-off-by: Adam Jackson <ajax@redhat.com>
* pcfGetProperties: Check string boundaries (CVE-2017-13722)Michal Srb2017-10-041-2/+11
| | | | | | | | Without the checks a malformed PCF file can cause the library to make atom from random heap memory that was behind the `strings` buffer. This may crash the process or leak information. Signed-off-by: Julien Cristau <jcristau@debian.org>
* Check for end of string in PatternMatch (CVE-2017-13720)Michal Srb2017-10-041-1/+3
| | | | | | | | If a pattern contains '?' character, any character in the string is skipped, even if it is '\0'. The rest of the matching then reads invalid memory. Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Julien Cristau <jcristau@debian.org>
* readme: Update for libXfont 2.0 interface changeAdam Jackson2017-04-271-6/+11
| | | | | | | | | | | | While xfs can be more or less trivially ported to 2.0, bcftopcf cannot because the font file I/O API is no longer externally visible. This is intentional, because bdftopcf is literally the only consumer of that API, and is itself only used in the build process for the classic core fonts themselves. The plan for bdftopcf is to import a copy of libXfont 1.5 and link against that statically instead. Signed-off-by: Adam Jackson <ajax@redhat.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
* autogen.sh: use quoted string variablesEmil Velikov2017-01-261-4/+4
| | | | | | | | | Place quotes around the $srcdir, $ORIGDIR and $0 variables to prevent fall-outs, when they contain space. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* autogen.sh: use exec instead of waiting for configure to finishPeter Hutterer2017-01-261-1/+1
| | | | | | | Syncs the invocation of configure with the one from the server. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* freetype: Fix a logic error in computing face nameAdam Jackson2016-06-101-1/+0
| | | | | | | | | gcc6 chirps an indentation warning here, but really this is bad code. Effectively this would ignore en_US or en_UK names for the font, despite that those are the English names the font is most likely to have. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>