wayland/cursor
Tobias Stoeckmann abcf1048e2 cursor: fix crash with weird input files
If a cursor file contains multiple images for the same size, this
typically indicates an animation. The compositor weston uses
wl_cursor_frame_and_duration to figure out at which time a specific image
should be shown.

The total delay is the sum of all image delays. But if all images have a
delay of 0, the total delay is 0 as well. The code does not check for this
special condition and triggers a floating point exception by eventually
performing a modulo operation with 0.

This, of course, could also happen if the sum of all image delays
triggers an unsigned int overflow. But since a comment in the code
already indicates that it does not try to "fix" handling of weird files,
I would argue that it's "okay" if that happens. At least the program
won't crash.

Proof of Concept:

install -D ~/.icons/poc/cursors
base64 -d > ~/.icons/poc/cursors/left_ptr << EOF
WGN1chAAAAAAAAEAAgAAAAIA/f8BAAAAKAAAAAIA/f8BAAAAKAAAACQAAAACAP3/AQAAAAEAAAAB
AAAAAQAAAAEAAAABAAAAAAAAAAAAAAA=
EOF
cat > /tmp/weston.ini << EOF
[shell]
cursor-theme=poc
EOF
weston -c /tmp/weston.ini

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2021-06-02 13:46:33 +00:00
..
convert_font.c cursor/convert_font.c: malloc cannot guarantee that the memory allocated is always successful 2020-10-29 13:00:20 +00:00
cursor-data.h (multiple): Include stdint.h 2016-07-25 18:39:32 -07:00
cursor.pcf cursor: add cursor.pcf and extraction program 2012-09-10 21:05:14 -04:00
meson.build Add Meson build 2020-01-10 23:44:38 +01:00
os-compatibility.c cursor: fix typo "insufficent" 2020-12-17 16:03:14 -05:00
os-compatibility.h cursor/os-compatibility: move resizing into a separate function 2020-02-23 20:42:54 +00:00
wayland-cursor.c cursor: fix crash with weird input files 2021-06-02 13:46:33 +00:00
wayland-cursor.h cursor: Properly document wl_cursor_image and wl_cursor 2020-06-05 11:05:20 +00:00
xcursor.c cursor: fix CVE-2013-2003 2021-05-02 21:35:23 +02:00
xcursor.h Use fixed size integer type 2020-09-04 12:27:23 +02:00