Commit graph

124 commits

Author SHA1 Message Date
Thomas E. Dickey
152f8e45db
fix stricter gcc warnings using casts
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-03-11 20:25:22 -05:00
Thomas E. Dickey
628cde0575
fix stricter gcc warnings by changing the type for the loop variable to
match the type of the loop limit

Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-03-11 20:25:15 -05:00
Thomas E. Dickey
ce907e36e0
quiet warnings for unused parameters
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-03-11 20:25:09 -05:00
Thomas E. Dickey
7623dae73c
fix a missing initializer
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-03-11 20:25:03 -05:00
Thomas E. Dickey
cea72e1427
quiet normal gcc warnings using casts (no object change)
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-03-11 20:24:54 -05:00
Valentin
204b6f1308 Fix undefined behavior
Without the casts the bytes accesses get converted to int. but int is
not guaranteed to be 4 bytes large. Even when it is 4 bytes large
`bytes[3] << 24` does not fit because int is signed.
2020-08-30 15:37:19 +02:00
Valentin
448398a3b9 Use fixed size integer type
This type is meant to be 4 bytes large as seen in _XcursorReadUInt which
always reads 4 bytes. An unsigned int is often 4 bytes large but this
isnt' guaranteed so it is cleaner to use the exact type we want.
2020-08-30 15:35:16 +02:00
Alan Coopersmith
b84b5d100f
libXcursor 1.2.0
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-03-10 17:36:26 -07:00
Alan Coopersmith
8ff9605921 Update configure.ac bug URL for gitlab migration
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-12-07 19:41:07 -08:00
Alan Coopersmith
534456082e Update README for gitlab migration
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-11-19 21:47:26 -08:00
Cosimo Cecchi
2263c196cb Support XDG user data dir location
Nowadays ~/.icons is not used anymore as the preferred location for
custom user icon themes; XDG_DATA_HOME/icons (aka ~/.local/share/icons)
is what toolkits like GTK prefer.

Prepend that location to the default xcursor path, so that cursor
themes installed there can be used by apps and toolkits that use
libXcursor.
2018-11-09 20:06:41 -08:00
Philipp Ludwig
f64a8cc1a6 Fix crash when encountering cursor themes with circular dependencies.
https://bugs.freedesktop.org/show_bug.cgi?id=3603

Signed-off-by: Philipp Ludwig <git-devel@philippludwig.net>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-03-23 23:22:22 -07:00
Matthieu Herrb
4828abe494 libXcursor 1.1.15
Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
2017-11-25 11:59:31 +01:00
Tobias Stoeckmann
4794b5dd34 Fix heap overflows when parsing malicious files. (CVE-2017-16612)
It is possible to trigger heap overflows due to an integer overflow
while parsing images and a signedness issue while parsing comments.

The integer overflow occurs because the chosen limit 0x10000 for
dimensions is too large for 32 bit systems, because each pixel takes
4 bytes. Properly chosen values allow an overflow which in turn will
lead to less allocated memory than needed for subsequent reads.

The signedness bug is triggered by reading the length of a comment
as unsigned int, but casting it to int when calling the function
XcursorCommentCreate. Turning length into a negative value allows the
check against XCURSOR_COMMENT_MAX_LEN to pass, and the following
addition of sizeof (XcursorComment) + 1 makes it possible to allocate
less memory than needed for subsequent reads.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
2017-11-25 11:52:34 +01:00
Mihail Konev
75b10c972d autogen: add default patch prefix
Signed-off-by: Mihail Konev <k.mvc@ya.ru>
2017-01-26 13:52:49 +10:00
Emil Velikov
721901fec3 autogen.sh: use quoted string variables
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>
2017-01-26 11:59:25 +10:00
Peter Hutterer
860bda4cb1 autogen.sh: use exec instead of waiting for configure to finish
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>
2017-01-26 11:59:25 +10:00
shubham shrivastav
897213f36b Insufficient memory for terminating null of string in _XcursorThemeInherits
Fix does one byte of memory allocation for null termination of string.
https://bugs.freedesktop.org/show_bug.cgi?id=90857

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-06-05 13:36:22 -07:00
Alan Coopersmith
edf52212a0 Fix some clang integer sign/size mismatch warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-10-18 10:52:49 -07:00
Alan Coopersmith
bbf3c582c9 Use strdup() instead of malloc(strlen())+strcpy()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-10-18 10:24:13 -07:00
Alan Coopersmith
2e6bda49d0 autogen.sh: Honor NOCONFIGURE=1
See http://people.gnome.org/~walters/docs/build-api.txt

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-06-04 18:04:51 -07:00
Alan Coopersmith
b1df53701f configure: Drop AM_MAINTAINER_MODE
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-06-04 18:04:51 -07:00
Alan Coopersmith
f92f118047 libXcursor 1.1.14
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-05-29 23:22:29 -07:00
Alan Coopersmith
8f677eaea0 signedness bug & integer overflow in _XcursorFileHeaderCreate() [CVE-2013-2003]
When parsing cursor files, a user defined (e.g. through environment
variables) cursor file is opened and parsed.

The header is read in _XcursorReadFileHeader(), which reads an unsigned
int for the number of toc structures in the header, but it was being
passed to _XcursorFileHeaderCreate() as a signed int to allocate those
structures.  If the number was negative, it would pass the bounds check
and could overflow the calculation for how much memory to allocate to
store the data being read, leading to overflowing the buffer with the
data read from the user controlled file.

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-04-26 17:22:43 -07:00
Alan Coopersmith
1b98fd6a2e Replace deprecated Automake INCLUDES variable with AM_CPPFLAGS
Excerpt https://lists.gnu.org/archive/html/automake/2012-12/msg00038.html

  - Support for the long-deprecated INCLUDES variable will be removed
    altogether in Automake 1.14.  The AM_CPPFLAGS variable should be
    used instead.

This variable was deprecated in Automake releases prior to 1.10, which is
the current minimum level required to build X.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-01-15 18:51:39 -08:00
Alan Coopersmith
2a9eaf3305 libXcursor 1.1.13
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-07 18:54:15 -08:00
Alan Coopersmith
8229cf75b3 XcursorImageLoadCursor: return failure if _XcursorGetDisplayInfo fails
Error: Null pointer dereference (CWE 476)
   Read from null pointer 'info'
        at line 615 of src/cursor.c in function 'XcursorImageLoadCursor'.
          Function '_XcursorGetDisplayInfo' may return constant 'NULL' at line 134, called at line 597.
          Null pointer introduced at line 134 of src/display.c in function '_XcursorGetDisplayInfo'.

[ This bug was found by the Parfait 0.3.7 bug checking tool.
  For more information see http://labs.oracle.com/projects/parfait/ ]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-30 18:59:43 -08:00
Alan Coopersmith
2b8d373bdd XcursorFileSaveImages: plug memory leak on invalid input
Error: Memory leak (CWE 401)
   Memory leak of pointer 'comments' allocated with XcursorCommentsCreate(0)
        at line 982 of src/file.c in function 'XcursorFileSaveImages'.
          'comments' allocated at line 978 with XcursorCommentsCreate(0).
          comments leaks when comments != 0 at line 981.

[ This bug was found by the Parfait 0.3.7 bug checking tool.
  For more information see http://labs.oracle.com/projects/parfait/ ]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-30 18:59:33 -08:00
Jon TURNEY
bcfb8e8ce5 Add generated Xcursor.h to .gitignore
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by:  Gaetan Nadon <memsize@videotron.ca>
Tested-by: Gaetan Nadon <memsize@videotron.ca>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-09-25 13:17:19 +01:00
Jon TURNEY
862b9ce4aa Fix install of generated Xcursor.h when builddir != srcdir
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by:  Gaetan Nadon <memsize@videotron.ca>
Tested-by: Gaetan Nadon <memsize@videotron.ca>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-09-25 13:15:30 +01:00
Alan Coopersmith
334dc4f4df Set Xcursor.h version numbers from configure.ac
Based on similar commit dac73a519816 to libXft

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
2011-09-19 17:30:15 -07:00
Alan Coopersmith
e086eb1bf4 Strip trailing whitespace
Performed with: find * -type f | xargs perl -i -p -e 's{\s+$}{\n}'
git diff -w & git diff -b show no diffs from this change

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-09-16 21:26:17 -07:00
Alan Coopersmith
d79ddc01e4 libXcursor 1.1.12
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-06-29 21:41:09 -07:00
Alan Coopersmith
4ce23fcd97 Mark bitmasks as unsigned ints
Clears Sun compiler warnings from shifting 8 bits by 24 bits:
"cursor.c", line 215: warning: integer overflow detected: op "<<"
"cursor.c", line 280: warning: integer overflow detected: op "<<"

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-05-22 12:55:31 -07:00
Jeremy Huddleston
047993c76a Correct error handling in _XcursorAverageColor
Previously it would either div-zero or get stuck in a loop until int overflow
if called with a bad value.

cursor.c:214:32: warning: Division by zero
    return (0xff << 24) | ((red/npixels) << 16) | ((green/npixels) << 8) | (blue/npixels);

Found-by: clang static analyzer
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-05-07 10:16:18 -07:00
Chris Wilson
bee68e54e5 Free the FontInfo structure after loading the cursor from it.
References: https://bugs.freedesktop.org/show_bug.cgi?id=2731
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-04-01 12:16:56 +01:00
Chris Wilson
f49e7e1608 Free the partial header after failing to open the cursor.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-04-01 12:16:56 +01:00
Chris Wilson
073eb2c56f Free list on shutdown.
We freed the parent structure without freeing the list contained within,
making valgrind unhappy.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-04-01 12:16:56 +01:00
Gaetan Nadon
de50317ec4 config: perform XCURSORPATH formatting in man/Makefile.am
We can skip the extra step of using XCURSORPATH_LIST in configure.ac.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2011-02-02 17:08:19 -05:00
Gaetan Nadon
a929c3621b config: comment, minor upgrade, quote and layout configure.ac
Group statements per section as per Autoconf standard layout
Quote statements where appropriate.
Autoconf recommends not using dnl instead of # for comments

Use AC_CONFIG_FILES to replace the deprecated AC_OUTPUT with parameters.

This helps automated maintenance and release activities.
Details can be found in http://wiki.x.org/wiki/NewModuleGuidelines

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2011-02-02 16:36:54 -05:00
Gaetan Nadon
96c5877fd7 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2011-01-28 19:41:37 -05:00
Gaetan Nadon
4f7a749fcb config: replace deprecated AC_HELP_STRING with AS_HELP_STRING
This silences an Automake warning.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2011-01-28 16:07:07 -05:00
Gaetan Nadon
c38adc6bf1 config: remove AC_PROG_CC as it overrides AC_PROG_C_C99
XORG_STRICT_OPTION from XORG_DEFAULT_OPTIONS calls
AC_PROG_C_C99. This sets gcc with -std=gnu99.
If AC_PROG_CC macro is called afterwards, it resets CC to gcc.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2011-01-27 18:50:14 -05:00
Alan Coopersmith
731e84d79e libXcursor 1.1.11
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-10-27 22:48:19 -07:00
Gaetan Nadon
42b7717c32 man: whitespace management
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-08-16 19:28:57 -04:00
Gaetan Nadon
862bc06d58 man: reorder makefile statements
No functional change. Shadows are part of libman_PRE.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-08-16 19:25:25 -04:00
Gaetan Nadon
b18568dd5b man: store shadow man pages in git rather than generating them
Simplify the build process and the makefile.

Local fix in CVS for bug 5628 is not required
as the problem has been fixed in
util-macros d9062e4077ebfd0985baf8418f3d0f111b9ddbba

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-08-16 19:23:57 -04:00
Gaetan Nadon
68d830bcf6 config: upgrade to util-macros 1.8 for additional man page support
Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS
The value of MAN_SUBST is the same for all X.Org packages.

Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-08-16 19:05:35 -04:00
Gaetan Nadon
0caadca51c config: update AC_PREREQ statement to 2.60
Unrelated to the previous patches, the new value simply reflects
the reality that the minimum level for autoconf to configure
all x.org modules is 2.60 dated June 2006.

ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-03-29 16:50:33 -04:00
Gaetan Nadon
b511b260dd config: remove the pkgconfig pc.in file from EXTRA_DIST
Automake always includes it in the tarball.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-03-29 14:53:48 -04:00