Commit graph

43 commits

Author SHA1 Message Date
Alan Coopersmith
8b77c86a06 Strip trailing whitespace from source files
Performed with: `git ls-files | xargs perl -i -p -e 's{[ \t]+$}{}'`

`git diff -w` & `git diff -b` show no diffs from this change

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/287>
2025-08-02 18:38:26 -07:00
Alan Coopersmith
a53c45d69e CI_GET_*_INFO_*: add do ... while (0) to avoid -Wextra-semi-stmt warnings
Clears 24 warnings from clang of the form:

TextExt16.c:63:34: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
        CI_GET_DEFAULT_INFO_1D (fs, def);
                                        ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 15:23:52 -08:00
José Expósito
97fb5bda3d Fix buffer overrun in parse_omit_name
When `num_fields == 12`, if the last character of the pattern is '-',
the `buf` array is overrun.

This error has been found by a static analysis tool. This is the report:

    Error: OVERRUN (CWE-119):
    libX11-1.8.7/modules/om/generic/omGeneric.c:691: cond_at_most:
      Checking "length > 255" implies that "length" may be up to 255 on
      the false branch.
    libX11-1.8.7/modules/om/generic/omGeneric.c:695: alias:
      Assigning: "last" = "buf + length - 1". "last" may now point to as
      high as byte 254 of "buf" (which consists of 256 bytes).
    libX11-1.8.7/modules/om/generic/omGeneric.c:718: ptr_incr:
      Incrementing "last". "last" may now point to as high as byte 255
      of "buf" (which consists of 256 bytes).
    libX11-1.8.7/modules/om/generic/omGeneric.c:720: ptr_incr:
      Incrementing "last". "last" may now point to as high as byte 256
      of "buf" (which consists of 256 bytes).
    libX11-1.8.7/modules/om/generic/omGeneric.c:720: overrun-local:
      Overrunning array of 256 bytes at byte offset 256 by
      dereferencing pointer "++last".
    #  718|               *++last = '*';
    #  719|
    #  720|->         *++last = '-';
    #  721|           break;
    #  722|       case 13:

Signed-off-by: José Expósito <jexposit@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/250>
2024-05-07 08:54:50 +00:00
Matthieu Herrb
8382253010 Avoid NULL pointer deref. Fixes issue #47.
Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
2021-12-03 02:56:43 +00:00
Matthieu Herrb
acdaaadcb3 Fix an integer overflow in init_om()
CVE-2020-14363

This can lead to a double free later, as reported by Jayden Rivers.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
2020-08-19 12:46:57 +02:00
Alan Coopersmith
2b7598221d Fix spelling/wording issues
Found by using:
    codespell --builtin clear,rare,usage,informal,code,names

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-22 15:19:58 -07:00
walter harms
9abe838007 no need to check XFree arguments
You can save a bit of code. The is no need to check XFree arguments bring  free_fontdataOM in line with other free function and check for NULL arg

Signed-off-by: harms wharms@bfs.de
2017-08-20 21:41:41 +02:00
Alan Coopersmith
4359dfabc0 Delete #if 0 hunks of code
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-12-18 23:50:26 -08:00
Alan Coopersmith
07a97b3944 Bug 93184: read_EncodingInfo invalid free
Free the correct bits of memory if we run out and need to unwind

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93184
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-12-03 23:21:31 -08:00
Alan Coopersmith
26e0d2de29 Replace Xmalloc+memset pairs with Xcalloc calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-06-04 20:51:17 -07:00
Bhavi Dhingra
f0286b2770 omGeneric.c: Correct the parameter usage of sizeof
Incorrect parameter usage with sizeof. Earlier passed argument FontData
will be 4 bytes always as its a pointer hence the change is needed and
FontDataRec should be used for memset.

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-06-04 19:08:31 -07:00
walter harms
d81fed4614 Remove more redundant null checks before Xfree()
Signed-off-by: Harms <wharms@bfs,de>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-06-06 17:24:39 -07:00
Jon TURNEY
3d69b0a83e Don't try so hard to find a matching font with the given encoding
See http://sourceware.org/bugzilla/show_bug.cgi?id=10948

Currently, if the locale is UTF-8, no CJK fonts are installed, and someone
does XCreateFontSet() with a font name of "*", we end up asking the server
to list the (non-existent) fonts 11 times for each CJK encoding, which can
take a while.

A * wildcard can match multiple components in a XLFD name in XListFonts(),
so there's no need to try adding more than one to get a match.

We do try once with a leading '*-' in case the fontname isn't a full
well-formed XLFD name, maybe even that isn't needed?

(See also http://invisible-island.net/xterm/xterm.faq.html#slow_menus)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-12-13 22:27:08 -08:00
Alan Coopersmith
25a7a329de Remove even more casts of return values from Xmalloc/Xrealloc
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-08-20 12:51:09 -07:00
Alan Coopersmith
5d47a39978 omGeneric.c: convert sprintf calls to snprintf
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
2013-08-20 12:50:47 -07:00
Alan Coopersmith
208e586c80 omGeneric: remove space between struct name & member name
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-07-27 01:12:45 -07:00
Alan Coopersmith
9399caf2c1 unifdef MUSTCOPY
MUSTCOPY seems to have only been defined in <X11/Xmd.h> when building for
CRAY, to handle missing some sizes of integer type.

(mostly performed with unifdef, followed by some manual cleanup of
 spacing/indenting in the remaining code)

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-03-03 18:20:10 -08:00
Alan Coopersmith
b850adbdeb Convert malloc(strlen()); strcpy() sets to strdup
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-04-18 17:49:18 -07:00
Alan Coopersmith
09194042d3 Replace Xmalloc+bzero pairs with Xcalloc calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-04-18 17:49:13 -07:00
Ander Conselvan de Oliveira
ac1e2bff71 om: Fix memory leaks on get_font_name error paths.
While at it, remove unneeded check for NULL before Xfree.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-04-13 11:06:00 +03:00
Ander Conselvan de Oliveira
d749948f94 om: Fix potential memory leak in init_om.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-04-13 11:05:59 +03:00
Ander Conselvan de Oliveira
d0749d6abd om: Fix memory leak on read_EncodingInfo error path.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-04-13 11:05:59 +03:00
Josh Triplett
15e5eaf628 Remove support for building without XCB
And there was much rejoicing.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>

Consensus on #xorg-devel agrees with removing --without-xcb; in
particular, acks from Adam Jackson, Daniel Stone, Kristian Høgsberg,
Julien Cristau, and Rémi Cardona.
2010-06-03 22:19:14 -07:00
Gaetan Nadon
b5797597f8 config: move CWARNFLAGS from configure.ac to Makefile.am
Compiler warning flags should be explicitly set in the makefile
rather than being merged with other packages compiler flags.

Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-02-19 09:22:56 -05:00
Alan Coopersmith
ddb1786720 Purge CVS/RCS id tags
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2010-01-14 17:38:26 -08:00
Osamu Sayama
4d4676c0d6 set_fontset_extents crash after get_rotate_fontname fix in 2bef065b70
- In set_fontset_extents, check font_data is not NULL before running
  loop that may increment it to a non-NULL invalid pointer.
- Make sure get_rotate_fontname counts the final field

Fixes OpenSolaris bug 6913809: X application dumps core in ja_JP.UTF-8 locale
<http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6913809>

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-01-06 13:17:40 -08:00
Jeremy Huddleston
3bb020587c Split CFLAGS into CPPFLAGS and CFLAGS
On some build systems, CPPFLAGS is set to "-I/some/prefix/include".  If older
X11 headers are in /some/prefix/include, they will be preferred over the
shipped headers.  This corrects that problem.
2009-10-01 22:20:38 -07:00
Christoph Pfister
2bef065b70 X.Org Bug #21117: crash in get_rotate_fontname (omGeneric.c)
http://bugs.freedesktop.org/show_bug.cgi?id=21117

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-04-27 22:35:29 -07:00
Paulo Cesar Pereira de Andrade
8ba0ca32a6 Janitor: ansification, make distcheck, compiler warnings.
Only convert to use "ansi prototypes" the functions warned from
compilation with "./autogen.sh --prefix=/usr", on a Linux computer.

  Also, only address "trivial" compiler warning fixes in this commit.

  The new .gitignore is the output of a command like:
% find . -name .gitignore -exec cat {} \; | sort | uniq
and only the toplevel .gitignore file was kept.
2009-01-28 20:31:42 -02:00
Adam Jackson
f6af6dd2f7 Bug #14898: Don't abuse the sprintf() implementation.
The thing you're printing into should not itself appear in the list of
things to print from, that's bad juju.  Just use strcat().
2008-06-24 13:16:53 -04:00
Alan Coopersmith
cf49e53701 Strip whitespace from end of lines in source files 2008-06-17 14:41:17 -07:00
Tilman Sauerbeck
1c75a94790 Bug #10475: Fixed lots of char*/const char* mixups.
I didn't fix all of them, as that would require touching
public headers.
2007-04-06 11:59:31 +02:00
Jamey Sharp
f25b4b00e1 Move .cvsignore to .gitignore. 2006-02-19 12:28:41 -08:00
Jamey Sharp
881467b303 Merge the X11 and BIGREQS package sets: they were used in exactly the same places. 2006-02-19 02:14:11 +00:00
Kevin E Martin
9e96dbc343 Add check and cflags for malloc(0) returning NULL. 2005-12-03 04:41:47 +00:00
Keith Packard
6d84a8b132 Move i18n modules to top-level so they can be built in the right order (before xlib for non-loadable, after xlib for loadable).
Link i18n modules against xlib to resolve Xlib symbols used by them.
2005-07-15 04:08:51 +00:00
Alexander Gottwald
45f40126a7 Add $(top_srcdir)/src to include list 2005-07-14 19:50:00 +00:00
Keith Packard
d14cc5c896 Ammend AM_CFLAGS with all needed includes; cannot figure out an easy way to automate this. 2005-07-11 20:32:55 +00:00
Keith Packard
6e752ea120 Enable loadable i18n modules, making them configurable on the configure command line.
Clean up conditionals for XKB, XCMS, XLOCALEDIR
Create new lib directory for locale modules in ${X11_LIBDIR}/locale/lib. Add this to the default XLOCALEDIR search path.
Create separate X11_LOCALEDATADIR variable pointing at ${datadir}/X11/locale for installing locale data.
Split out xcms, xkb, xlibi18n sources from main xlib bits so they can be conditionally included more easily. Lots of source files have been moved with this step; the result seems like it might be easier to maintain.
Display message at end of configure script with selected options.
Fix manual building with cpp to add -traditional in cpprules.in. This isn't conditionalized at all, so it will break on systems not using GNU cpp.
2005-07-11 08:29:18 +00:00
Søren Sandmann Pedersen
7eee605e3a - For now put xtrans in X11/Xtrans/X11, since libX11 is looking for it in <X11/...>
- For Xcomposite and Xdamage, don't link the build system out of the xc tree
- Link the public X11 headers into their own directory
- Add links to XKeysymDB and XErrorDB
- Add links to all the Xlib man pages
- Add links to the lcUniConv subdirectory
- Conditionally include config.h in Xlib source
2005-05-13 22:53:36 +00:00
Søren Sandmann Pedersen
6e884b1291 Tue Jul 20 19:38:06 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Set font_data->xlfd_data to NULL after XFree(). (#837, patch from Bastien Nocera).
Tue Jul 20 18:23:32 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Use /dev/urandom on Linux.(#761).
2004-07-20 17:48:09 +00:00
Egbert Eich
c6349f4319 Merging XORG-CURRENT into trunk 2004-04-23 18:42:09 +00:00
Kaleb Keithley
deae12c6b6 R6.6 is the Xorg base-line 2003-11-14 15:54:30 +00:00