aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChloé Vulquin <code@toast.bunkerlabs.net>2024-03-28 13:44:36 +0100
committerChloé Vulquin <code@toast.bunkerlabs.net>2024-04-24 12:28:38 +0200
commit16aee2ec3829b37f4db623ab9ddab1b789bdd2e2 (patch)
tree2ab88bccf4d87192c5ff2bc77bc39ca9f08ec848
parentscanner: add validators for enums (diff)
downloadwayland-16aee2ec3829b37f4db623ab9ddab1b789bdd2e2.tar
wayland-16aee2ec3829b37f4db623ab9ddab1b789bdd2e2.tar.gz
wayland-16aee2ec3829b37f4db623ab9ddab1b789bdd2e2.tar.bz2
wayland-16aee2ec3829b37f4db623ab9ddab1b789bdd2e2.tar.lz
wayland-16aee2ec3829b37f4db623ab9ddab1b789bdd2e2.tar.xz
wayland-16aee2ec3829b37f4db623ab9ddab1b789bdd2e2.tar.zst
wayland-16aee2ec3829b37f4db623ab9ddab1b789bdd2e2.zip
xcursor: catch theme inheritance loops
As of currently, when an xcursor theme depends on itself or another theme that will eventually depend on it, `xcursor_load_theme` will recurse infinitely while processing the inherits. This change introduces a stack-allocated linked list of visited nodes by name, and skips any already visited nodes in the inherit list. Side effects: * Since the linked list is stack-allocated, there is a potential for an overflow if there is a very long list of dependencies. If this turns out to be a legitimate concern, the linked list is trivial to convert to being heap-allocated. * There is an existing linked list (technically doubly linked list) implementation in the wayland codebase. As of currently, the xcursor codebase does not refer to it. Consequently, this change writes a minimal single linked list implementation to utilize directly. This changeset fixes #317. Signed-off-by: Chloé Vulquin <toast@bunkerlabs.net>
-rw-r--r--cursor/xcursor.c90
1 files changed, 66 insertions, 24 deletions
diff --git a/cursor/xcursor.c b/cursor/xcursor.c
index 6766c56..0d5761f 100644
--- a/cursor/xcursor.c
+++ b/cursor/xcursor.c