fix: libwayland null guards made durable — appended to redox.patch
Three null-safety additions to wayland-client.c, now in the recipe's redox.patch so they survive source rebuilds: - wl_proxy_add_listener: return -1 on NULL (prevents null+8 page fault) - wl_proxy_get_version: return 0 on NULL - wl_proxy_get_display: return NULL on NULL
This commit is contained in:
@@ -36,4 +36,31 @@
|
||||
+}
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
+--- a/src/wayland-client.c
|
||||
++++ b/src/wayland-client.c
|
||||
+@@ -649,6 +649,11 @@
|
||||
+ wl_proxy_add_listener(struct wl_proxy *proxy,
|
||||
+ void (**implementation)(void), void *data)
|
||||
+ {
|
||||
++ if (!proxy) {
|
||||
++ fprintf(stderr, "FATAL: wl_proxy_add_listener(NULL) caller=%p -- returning error\n",
|
||||
++ __builtin_return_address(0));
|
||||
++ return -1;
|
||||
++ }
|
||||
+ if (proxy->flags & WL_PROXY_FLAG_WRAPPER)
|
||||
+ wl_abort("Proxy %p is a wrapper\n", proxy);
|
||||
+
|
||||
+@@ -2448,6 +2453,7 @@
|
||||
+ wl_proxy_get_version(struct wl_proxy *proxy)
|
||||
+ {
|
||||
++ if (!proxy) return 0;
|
||||
+ return proxy->version;
|
||||
+ }
|
||||
+
|
||||
+@@ -2566,6 +2572,7 @@
|
||||
+ wl_proxy_get_display(struct wl_proxy *proxy)
|
||||
+ {
|
||||
++ if (!proxy) return NULL;
|
||||
+ return proxy->display;
|
||||
+ }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user