Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:GA
wayland.28581
U_util-set-errno-when-hitting-WL_MAP_MAX_OBJECT...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File U_util-set-errno-when-hitting-WL_MAP_MAX_OBJECTS.patch of Package wayland.28581
From c7fc1e79ca50402acdd8627dcdf7dd0286924d99 Mon Sep 17 00:00:00 2001 From: Simon Ser <contact@emersion.fr> Date: Tue, 28 Jun 2022 11:59:26 +0200 Subject: [PATCH] util: set errno when hitting WL_MAP_MAX_OBJECTS Callers may check errno when wl_map_insert_* functions return an error (since [1]). Make sure it's always set to a meaningful value when returning an error, otherwise callers might end up checking an errno coming from a completely different function. [1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/205 Signed-off-by: Simon Ser <contact@emersion.fr> Fixes: b19488c7154b ("util: Limit size of wl_map") --- src/wayland-util.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) Index: wayland-1.19.0/src/wayland-util.c =================================================================== --- wayland-1.19.0.orig/src/wayland-util.c +++ wayland-1.19.0/src/wayland-util.c @@ -29,6 +29,7 @@ #include <stdio.h> #include <string.h> #include <stdarg.h> +#include <errno.h> #include "wayland-util.h" #include "wayland-private.h" @@ -229,6 +230,7 @@ wl_map_insert_new(struct wl_map *map, ui * better make it a NULL so wl_map_for_each doesn't * dereference it later. */ entry->data = NULL; + errno = ENOSPC; return 0; } entry->data = data; @@ -251,8 +253,10 @@ wl_map_insert_at(struct wl_map *map, uin i -= WL_SERVER_ID_START; } - if (i > WL_MAP_MAX_OBJECTS) + if (i > WL_MAP_MAX_OBJECTS) { + errno = ENOSPC; return -1; + } count = entries->size / sizeof *start; if (count < i) @@ -288,8 +292,10 @@ wl_map_reserve_new(struct wl_map *map, u i -= WL_SERVER_ID_START; } - if (i > WL_MAP_MAX_OBJECTS) + if (i > WL_MAP_MAX_OBJECTS) { + errno = ENOSPC; return -1; + } count = entries->size / sizeof *start; if (count < i)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor