Commit Graph

15 Commits

Author SHA1 Message Date
Simon Ser
0d314c4a04 build: don't rely on implicit GNU extensions
Currently libwayland assumes GNU extensions will be available, but
doesn't define the C standard to use. Instead, let's unconditionally
enable POSIX extensions, and enable GNU extensions on a case-by-case
basis as needed.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-01-10 15:08:46 +01:00
Tobias Stoeckmann
ed55438366 cursor: fix CVE-2013-2003
The libXcursor fix for CVE-2013-2003 has never been imported into
wayland, leaving it vulnerable to it.

Changing the argument type to an unsigned type is an effective merge of
Ilja Van Sprundel's commit in libXcursor.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2021-05-02 21:35:23 +02:00
Alexander Dunaev
0aebb5b94d cursor: add one more directory to XCURSORPATH
The user may install cursor themes manually, and the desktop environment
may provide a special directory for storing them.  For instance, GTK puts
those themes into ~/.local/share/icons, and many Linux distributions suggest
using that directory for user-specific themes.  However, users of
libwayland-cursor cannot load these themes using the API provided by the
library because the latter does not look into that directory.

This patch adds ~/.local/share/icons to the search path, so user-specific
themes can be loaded through the API provided by libwayland-cursor.

Signed-off-by: Alexander Dunaev <adunaev@igalia.com>
Reviewed-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Simon Ser <contact@emersion.fr>
2021-04-27 11:16:17 +00:00
Valentin
1ab6a81816 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.

Signed-off-by: Valentin Kettner <vakevk@gmail.com>
2020-09-04 12:27:33 +02:00
Tobias Stoeckmann
5d201df72f cursor: Fix heap overflows when parsing malicious files.
It is possible to trigger heap overflows due to an integer overflow
while parsing images.

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.

See also: https://cgit.freedesktop.org/xorg/lib/libXcursor/commit/?id=4794b5dd34688158fb51a2943032569d3780c4b8
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=103961

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
[Pekka: add link to the corresponding libXcursor commit]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-29 09:45:10 +02:00
Bryce Harrington
1faeb7ff48 xcursor: Change keithp licensed code from X11 to Expat license
The license text for this file mentions Keith Packard specifically,
however it is otherwise identical to all the other MIT X11 licensed code
in Wayland, and so can be changed to the substantially identical MIT
Expat license.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Keith Packard <keithp@keithp.com>
2015-06-12 15:51:38 -07:00
U. Artie Eoff
02952d040c xcursor: don't proceed if XcursorImageCreate failed
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-15 10:46:09 -08:00
Rob Bradford
0201708773 xcursor: Fix allocation based on string length
strlen() doesn't include the terminating NUL. Therefore when allocating a
block of memory to hold something equivalent to the length of the string we
must increment to take the NUL byte into consideration.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
2012-10-09 23:01:23 -04:00
Christopher Michael
b57694ca0e Add support for X cursor themes.
This patch adds a few more directories to search for xcursor themes.

Along with the weston patch, this adds the ability to configure weston
to use an X11 cursor theme. Previously, wayland cursor would just look
in the icons and pixmaps directories for cursor images to load. This
adds the ability to also search in the x cursors directory.
2012-08-13 11:02:56 -04:00
Dima Ryazanov
31c0258ff1 Don't skip the first directory entry when reading cursors.
I end up missing the "bottom_right_corner" cursor.
2012-07-26 22:04:32 -04:00
Ander Conselvan de Oliveira
2261007953 wayland-cursor: Plug leak of filename on load_all_cursors_from_dir() 2012-06-19 11:36:31 -04:00
Daniel Stone
61260854ec Xcursor: Don't ignore unknown file types
XFS doesn't return the file type with opendir(), and instead only
returns it when you stat() the file itself.  c66f2602 introduced a check
to ensure that only files and symlinks were loaded, while not checking
for DT_UNKNOWN.  Properly handle DT_UNKNOWN by just proceeding anyway.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-18 15:15:11 -04:00
Ander Conselvan de Oliveira
c66f26024b wayland-cursor: load all cursors from a theme on wl_cursor_theme_load 2012-05-25 23:06:27 -04:00
Kristian Høgsberg
5030af7635 cursor: Fix unsigned/signed comparisons 2012-05-22 22:41:21 -04:00
Ander Conselvan de Oliveira
775002c6c0 Introduce libwayland-cursor, a cursor helper library
The purpose of this library is to be the equivalent of libXcursor in
the X world. This library is compatible with X cursor themes and loads
them directly into an shm pool making it easy for the clients to get
buffer for each cursor image.

The code for handling the X cursor theme was taken from libXcursor. The
files cursor/xcursor.[ch] are a stripped down version of that library
containing only the interfaces necessary for implementing the wayland
counterpart.
2012-05-22 15:20:13 -04:00