summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wayland
diff options
context:
space:
mode:
authorBryce Harrington <bryce@osg.samsung.com>2015-03-20 22:07:27 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-03-20 22:07:27 -0400
commitdaf10dd2badad14742fa06e4c511379e6f163840 (patch)
treec14a5787a1ebc41cde4d3ff611b8e70de6c978c4 /src/lib/ecore_wayland
parent931db7f12edaf56e0eeeb7d5ddbfbed147931941 (diff)
ecore_wayland: Check for nulls before wayland calls
Summary: Wayland API routines by policy do not check input parameters for invalid values. In particular, many calls are wrappers through wl_proxy_marshal, which derefs its first argument without a check. So, for all wayland calls, always null check the first argument. Reviewers: zmike, cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2211
Diffstat (limited to 'src/lib/ecore_wayland')
-rw-r--r--src/lib/ecore_wayland/ecore_wl_subsurf.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl_subsurf.c b/src/lib/ecore_wayland/ecore_wl_subsurf.c
index f34febf..3c92ce8 100644
--- a/src/lib/ecore_wayland/ecore_wl_subsurf.c
+++ b/src/lib/ecore_wayland/ecore_wl_subsurf.c
@@ -71,8 +71,13 @@ _ecore_wl_subsurf_destroy(Ecore_Wl_Subsurf *ess)
71{ 71{
72 Ecore_Wl_Window *parent; 72 Ecore_Wl_Window *parent;
73 73
74 wl_subsurface_destroy(ess->subsurface); 74 if (!ess) return;
75 wl_surface_destroy(ess->surface); 75
76 if (ess->subsurface)
77 wl_subsurface_destroy(ess->subsurface);
78
79 if (ess->surface)
80 wl_surface_destroy(ess->surface);
76 81
77 parent = ess->parent_win; 82 parent = ess->parent_win;
78 parent->subsurfs = (Ecore_Wl_Subsurf *)eina_inlist_remove 83 parent->subsurfs = (Ecore_Wl_Subsurf *)eina_inlist_remove
@@ -120,6 +125,7 @@ ecore_wl_subsurf_position_set(Ecore_Wl_Subsurf *ess, int x, int y)
120 LOGFN(__FILE__, __LINE__, __FUNCTION__); 125 LOGFN(__FILE__, __LINE__, __FUNCTION__);
121 126
122 if (!ess) return; 127 if (!ess) return;
128 if (!ess->subsurface) return;
123 129
124 if ((x == ess->x) && (y == ess->y)) 130 if ((x == ess->x) && (y == ess->y))
125 return; 131 return;
@@ -148,6 +154,7 @@ ecore_wl_subsurf_place_above(Ecore_Wl_Subsurf *ess, struct wl_surface *surface)
148 154
149 if (!ess) return; 155 if (!ess) return;
150 if (!surface) return; 156 if (!surface) return;
157 if (!ess->subsurface) return;
151 158
152 wl_subsurface_place_above(ess->subsurface, surface); 159 wl_subsurface_place_above(ess->subsurface, surface);
153} 160}
@@ -159,6 +166,7 @@ ecore_wl_subsurf_place_below(Ecore_Wl_Subsurf *ess, struct wl_surface *surface)
159 166
160 if (!ess) return; 167 if (!ess) return;
161 if (!surface) return; 168 if (!surface) return;
169 if (!ess->subsurface) return;
162 170
163 wl_subsurface_place_below(ess->subsurface, surface); 171 wl_subsurface_place_below(ess->subsurface, surface);
164} 172}
@@ -169,6 +177,7 @@ ecore_wl_subsurf_sync_set(Ecore_Wl_Subsurf *ess, Eina_Bool val)
169 LOGFN(__FILE__, __LINE__, __FUNCTION__); 177 LOGFN(__FILE__, __LINE__, __FUNCTION__);
170 178
171 if (!ess) return; 179 if (!ess) return;
180 if (!ess->subsurface) return;
172 181
173 val = !!val; 182 val = !!val;
174 if (val == ess->sync) return; 183 if (val == ess->sync) return;
@@ -189,10 +198,13 @@ ecore_wl_subsurf_opaque_region_set(Ecore_Wl_Subsurf *ess, int x, int y, int w, i
189 LOGFN(__FILE__, __LINE__, __FUNCTION__); 198 LOGFN(__FILE__, __LINE__, __FUNCTION__);
190 199
191 if (!ess) return; 200 if (!ess) return;
201 if (!ess->surface) return;
192 202
193 if ((w > 0) && (h > 0)) 203 if ((w > 0) && (h > 0))
194 { 204 {
195 region = wl_compositor_create_region(_ecore_wl_compositor_get()); 205 region = wl_compositor_create_region(_ecore_wl_compositor_get());
206 if (!region) return;
207
196 wl_region_add(region, x, y, w, h); 208 wl_region_add(region, x, y, w, h);
197 wl_surface_set_opaque_region(ess->surface, region); 209 wl_surface_set_opaque_region(ess->surface, region);
198 wl_region_destroy(region); 210 wl_region_destroy(region);