Commit graph

1047 commits

Author SHA1 Message Date
Alan Coopersmith
1f6a3dbf69 integer overflow in XGetMotionEvents() [CVE-2013-1981 4/13]
If the reported number of motion events is too large, the calculations
to allocate memory for them may overflow, leaving us writing beyond the
bounds of the allocation.

v2: Ensure nEvents is set to 0 when returning NULL events pointer

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-05-09 18:59:50 -07:00
Alan Coopersmith
39515b7c3b integer overflow in XListFontsWithInfo() [CVE-2013-1981 3/13]
If the reported number of remaining fonts is too large, the calculations
to allocate memory for them may overflow, leaving us writing beyond the
bounds of the allocation.

v2: Fix reply_left calculations, check calculated sizes fit in reply_left
v3: On error cases, also set values to be returned in pointer args to 0/NULL

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-05-09 18:59:50 -07:00
Alan Coopersmith
5669a22081 integer overflow in _XF86BigfontQueryFont() [CVE-2013-1981 2/13]
Similar to _XQueryFont, but with more ways to go wrong and overflow.
Only compiled if libX11 is built with XF86BigFont support.

v2: Fix reply_left calculations, check calculated sizes fit in reply_left

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-05-09 18:59:50 -07:00
Alan Coopersmith
6df8a63d34 integer overflow in _XQueryFont() on 32-bit platforms [CVE-2013-1981 1/13]
If the CARD32 reply.nCharInfos * sizeof(XCharStruct) overflows an
unsigned long, then too small of a buffer will be allocated for the
data copied in from the reply.

v2: Fix reply_left calculations, check calculated sizes fit in reply_left

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-05-09 18:59:50 -07:00
Alan Coopersmith
9f5d837065 Add _XEatDataWords to discard a given number of 32-bit words of reply data
Matches the units of the length field in X protocol replies, and provides
a single implementation of overflow checking to avoid having to replicate
those checks in every caller.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
2013-05-09 18:59:50 -07:00
Alan Coopersmith
d7f04c340a Move repeated #ifdef magic to find PATH_MAX into a common header
Lets stop duplicating the mess all over

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
2013-05-09 18:59:50 -07:00
Pander
f3a553a4e4
Add compose sequences for J́ and j́.
The resulting sequences are:

  U+004A LATIN CAPITAL LETTER J  U+0301 COMBINING ACUTE ACCENT
  U+006A LATIN SMALL LETTER J    U+0301 COMBINING ACUTE ACCENT

Used in Dutch, per:

  http://lists.x.org/archives/xorg-devel/2013-February/035514.html
  https://nl.wikipedia.org/wiki/Accenttekens_in_de_Nederlandse_spelling

Signed-off-by: Pander <pander@users.sourceforge.net>
Signed-off-by: James Cloos <cloos@jhcloos.com>
2013-05-07 18:38:14 -04:00
Alan Coopersmith
f49bb2dd6d Move big request comment in XOpenDisplay to the right place
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-03-16 23:35:18 -07:00
Alan Coopersmith
3996543c1b libX11 1.5.99.901 (1.6 RC1)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-03-09 19:16:03 -08:00
Alan Coopersmith
f9cd175a47 Fix very weird indenting in src/GetFProp.c
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-03-08 22:34:24 -08:00
Alan Coopersmith
e9bd757630 XAllocClassHint: Assume calloc sets pointers in allocated memory to NULL
While the C standard technically allows for the compiler to translate
pointer = 0 or pointer = NULL into something other than filling the
pointer address with 0 bytes, the rest of the Xlib code already assumes
that calloc initializes any pointers in the struct to NULL, and there
are no known systems supported by X.Org where this is not true.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-03-08 18:56:26 -08:00
Karl Tomlinson
39547d600a MakeBigReq: don't move the last word, already handled by Data32
MakeBigReq inserts a length field after the first 4 bytes of the request
(after req->length), pushing everything else back by 4 bytes.

The current memmove moves everything but the first 4 bytes back.
If a request aligns to the end of the buffer pointer when MakeBigReq is
invoked for that request, this runs over the buffer.
Instead, we need to memmove minus the first 4 bytes (which aren't moved),
minus the last 4 bytes (so we still align to the previous tail).

The 4 bytes that fell out are already handled with Data32, which will
handle the buffermax correctly.

The case where req->length = 1 was already not functional.

Reported by Abhishek Arya <inferno@chromium.org>.

https://bugzilla.mozilla.org/show_bug.cgi?id=803762

Reviewed-by: Jeff Muizelaar <jmuizelaar@mozilla.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-03-08 17:31:12 -08:00
Quentin Glidic
3cdb6c3a16 nls/Makefile.am: Use LOG_COMPILER
TESTS_ENVIRONMENT is deprecated

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-03-08 17:26:48 -08:00
Quentin Glidic
df66d7a98e nls/Makefile.am: Remove unneeded $(srcdir)
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-03-08 17:26:48 -08:00
Alan Coopersmith
3facbe5c0d Add <X11/Xresource.h> hint to all Xrm* man pages
Help users figure out which header file they need to #include

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-03-08 17:17:02 -08:00
Alan Coopersmith
466404007f _xudc_code_to_glyph: check for NULL pointer *before* writing to it, not after
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-03-08 17:17:00 -08:00
Ken Moffat
47d2eff64d
dead_double_grave and dead_inverted_breve should only have one underscore.
Correct instances of dead_double_grave and dead_inverted_breve to
dead_doublegrave and dead_invertedbreve.

Signed-off-by: Ken Moffat <ken@linuxfromscratch.org>
Signed-off-by: James Cloos <cloos@jhcloos.com>
2013-03-07 18:27:54 -05:00
Alan Coopersmith
c23d61d1b8 Assume size_t is always available, since it was defined in C89
Don't provide a fallback definition #ifdef X_NOT_POSIX anymore.
We already use size_t throughout the rest of Xlib, just had this
one instance left in XKBGAlloc.c of a fallback definition.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-03-03 18:20:50 -08:00
Alan Coopersmith
9bcfd84aa1 unifdef XKB_IN_SERVER
Leftovers from XKB files that were previously shared between the client
and server code, but aren't any more.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-03-03 18:20:45 -08:00
Alan Coopersmith
769a0efa22 unifdef CRAY & _CRAY
(mostly performed with unifdef, followed by some manual cleanup of
 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:41 -08:00
Alan Coopersmith
ca106eb03e unifdef WORD64
WORD64 seems to have only been defined in <X11/Xmd.h> when building for
CRAY, to handle int being a 64-bit value (ILP64, not LP64) and having
64-bit alignment requirements.

It hadn't been fully supported even before autotooling, as can be
seen by removed code such as:

 #ifdef WORD64
 _XkbWriteCopyData32 Not Implemented Yet for sizeof(int)==8
 #endif

(mostly performed with unifdef, followed by some manual cleanup of
 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:34 -08: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
b687440c28 Convert more sprintf calls to snprintf
You could analyze most of these and quickly recognize that there was no
chance of buffer overflow already, but why make everyone spend time doing
that when we can just make it obviously safe?

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-02-16 10:42:23 -08:00
Alan Coopersmith
b092dabbd7 XKeysymToString: move variable declarations to the scope of their usage
Makes it easier for readers to understand scope of variable usage, and
clears up gcc warning:

KeysymStr.c: In function 'XKeysymToString':
KeysymStr.c:128:13: warning: declaration of 'i' shadows a previous local [-Wshadow]
KeysymStr.c:73:18: warning: shadowed declaration is here [-Wshadow]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-02-16 10:20:53 -08:00
Alan Coopersmith
f0b171c8ea Preserve constness in casting arguments through the Data*() routines
Casts were annoying gcc by dropping constness when changing types,
when routines simply either copy data into the request buffer or
send it directly to the X server, and never modify the input.

Fixes gcc warnings including:
ChProp.c: In function 'XChangeProperty':
ChProp.c:65:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
ChProp.c:65:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
ChProp.c:74:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
ChProp.c:74:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
ChProp.c:83:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
SetHints.c: In function 'XSetStandardProperties':
SetHints.c:262:20: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
SetPntMap.c: In function 'XSetPointerMapping':
SetPntMap.c:46:5: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
SetPntMap.c:46:5: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
StBytes.c: In function 'XStoreBuffer':
StBytes.c:97:33: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
StName.c: In function 'XStoreName':
StName.c:40:27: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
StName.c: In function 'XSetIconName':
StName.c:51:27: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-02-16 10:20:53 -08:00
Alan Coopersmith
6c558ee357 Fix comment typo & confusing indentation levels in Data() macro definition
The final } matches the one on the #define line, not one that doesn't
appear after the else statement it was lined up with

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-02-16 10:20:53 -08:00
Alan Coopersmith
afd6593da9 XStringToKeysym: preserve constness when casting off unsignedness for strcmp
Fixes gcc warning:
StrKeysym.c:97:17: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-02-16 10:20:53 -08:00
Alan Coopersmith
7e3bf4dd83 XRebindKeysym: Drop unnecessary const-removing cast
C89 defines memcpy as taking a const void *, so casting from
const unsigned char * to char * simply angers gcc for no benefit:

KeyBind.c:1017:24: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-02-16 10:20:52 -08:00
Alan Coopersmith
54527eab93 cmsColNm.c: maintain constness of arguments to qsort helper function
Fixes gcc warning:

cmsColNm.c: In function 'FirstCmp':
cmsColNm.c:257:20: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
cmsColNm.c:257:45: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-02-15 22:45:19 -08:00
Nickolai Zeldovich
deedeada53 XListFontsWithInfo: avoid accessing realloc'ed memory
If exactly one of the two reallocs in XListFontsWithInfo() fails, the
subsequent code accesses memory freed by the other realloc.

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-02-15 22:26:38 -08:00
Colin Walters
f57fd760cb autogen.sh: Implement GNOME Build API
http://people.gnome.org/~walters/docs/build-api.txt

Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-01-15 14:32:12 -05:00
Adam Jackson
51c102d39e configure: Remove AM_MAINTAINER_MODE
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-01-15 14:28:48 -05:00
Alan Coopersmith
3cd974b1d4 Remove unused DECnet ("DNETCONN") code from Xlib
Has never been converted to build in modular builds, so has been unusable
since X11R7.0 release in 2005.  DNETCONN support was removed from xtrans
back in 2008.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-01-09 20:50:32 -08:00
Alan Coopersmith
a6e5b36a3e Remove unused TLI ("STREAMSCONN") code from Xlib
Has never been converted to build in modular builds, so has been unusable
since X11R7.0 release in 2005.  All known platforms with TLI/XTI support
that X11R7 & later releases run on also have (and mostly prefer) BSD
socket support for their networking API.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-01-09 20:50:32 -08:00
Alan Coopersmith
59c9ee8cd5 Tell clang not to report -Wpadded warnings on public headers we can't fix
Better to silence the compiler warning than break ABI.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-01-09 20:50:32 -08:00
Jon TURNEY
0b14875002 Fix config check for loadable modules
The config check of the results of testing for dlfcn.h or dl.h just tests the
value of the ac_cv_ variables, which will be 'yes' or 'no', rather than checking
it is 'yes', so loadable module support would always be detected.

This is necessary for successful compilation for the MinGW target without the
optional dlfcn-win32 library.

v2: Also, fixed typoed name of ac_cv_header_dlfcn_h, so check still works
correctly when dlfcn.h is available

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2013-01-09 14:49:41 +00:00
Egbert Eich
cd25cab4b5 Install Xcms.txt in $(datadir) rather than $(libdir).
This file is an architecture independent data and should be where
other databases are.
This is the Xlib provided sample file, applications are free to
use a different one specifying its location in the XCMSDB env
variable.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-01-03 10:36:13 -05:00
Egbert Eich
51fef7e273 Don't hard code path to Xcms.txt file.
The path to this file is configurable at build time. The source
however contains a hard coded path.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-01-03 10:35:43 -05:00
Colin Walters
9833489e6c Fix build after dropping locales
They also needed to be removed from configure.ac

Signed-off-by: Colin Walters <walters@verbum.org>
Signed-off-by: Julien Cristau <jcristau@debian.org>
2012-12-07 15:13:14 +01:00
Egbert Eich
0a740a574a i18n: Uppercased all occurances if 'iso8859' in the full locale name.
Making all occurances of iso8859 upper case in the full local name
makes the alias entries more consistent and match the entries on
locale.dir.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-12-06 05:46:17 -05:00
Egbert Eich
5e7d589697 i18n: Remove ja.S90 and ja.U90 locales.
Both locales carry a copyright notice and a prorietary statement:

Copyright 1995 by FUJITSU LIMITED
This is source code modified by FUJITSU LIMITED under the Joint
Development Agreement for the CDEnext PST.
This is unpublished proprietary source code of FUJITSU LIMITED

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-12-06 05:46:17 -05:00
Egbert Eich
99eae3dcb7 i18n: Bring locale.dir and compose.dir in sync.
Some entries for locale/encoding combinations were missing from
either file or just misspelled, some entries were wrong or just
aliases.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-12-06 05:46:17 -05:00
Egbert Eich
d1e6baa4e2 i18n: Treat 'a3_AZ' as an alias for 'az_AZ'.
locale.alias contains a comment:
XCOMM a3 is not an ISO 639 language code, but in Cyrillic, "Z" looks like "3".
Thus lets treat 'a3' as an alias for 'az'.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Magnus Kessler <Magnus.Kessler@gmx.net>
2012-12-06 05:46:06 -05:00
Egbert Eich
fa2aab0bea i18n: Fixed typos in full locale names.
Fixing those typos those names actually match entries in
locale.dir.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-12-05 11:51:19 -05:00
Egbert Eich
b88dd95005 i18n: Remove duplicates and aliases to oneself.
Aliases to itself don't make much sense.
This changes occurances of:
xy_UV.UTF-8:			xy_UV.UTF-8
to
xy_UV:			xy_UV.UTF-8
where applicable.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: James Cloos <cloos@jhcloos.com>
2012-12-03 05:18:40 -05:00
Jens Herden
f198c6aa98 i18n: Add support for Khmer locale and compose table.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: James Cloos <cloos@jhcloos.com>
2012-12-03 05:18:17 -05:00
Kalman Kemenczy
4076189869 i18n: Add support for Serbian specific compose table entries.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: James Cloos <cloos@jhcloos.com>
2012-12-03 05:17:53 -05:00
Egbert Eich
7c14aacc9f i18n: Adding and removing comments.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: James Cloos <cloos@jhcloos.com>
2012-12-03 05:16:46 -05:00
Egbert Eich
7754d68976 i18n: Add missing locales which existed in locale.alias.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: James Cloos <cloos@jhcloos.com>
2012-12-03 05:16:31 -05:00
Egbert Eich
952eccd0d2 i18n: Consolidate compose handling for locales with UTF-8 encoding.
- add an entry to include the default en_US compose file
  for the ja_JP, ko_KR, th_TH, zh_CN, zh_HK and zh_TW locales.
- add missing entries for zh_CN. and zh_HK and am_ET.
- change entries for the UTF-8 encoding for ru_RU, ja_JP,
  ko_KR, th_TH and zh_TW to point to their native directory
  entries.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: James Cloos <cloos@jhcloos.com>
2012-11-30 09:36:51 -05:00