Re: [PATCH weston 4/5] ivi-shell: harden get_ivi_shell_surface()

2016-03-24 Thread Pekka Paalanen
On Thu, 24 Mar 2016 11:30:52 +0100
Eugen Friedrich  wrote:

> 2016-03-22 15:48 GMT+01:00 Pekka Paalanen :
> > From: Pekka Paalanen 
> >
> > Add more sanity checks to get_ivi_shell_surface() just in case.
> >
> > If the configure hook is set, we must always have non-NULL
> > configure_private.
> >
> > Check the ivi_shell_surface matches the surface.
> >
> > Signed-off-by: Pekka Paalanen 
> > ---
> >  ivi-shell/ivi-shell.c | 12 +---
> >  1 file changed, 9 insertions(+), 3 deletions(-)

> 
> Looks good
> Reviewed-by: Eugen Friedrich 

Cool, the four patches pushed:
   1c04d7b..94cb06a  master -> master


Thanks,
pq


pgpEPyEhhv4kQ.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 4/5] ivi-shell: harden get_ivi_shell_surface()

2016-03-24 Thread Eugen Friedrich
2016-03-22 15:48 GMT+01:00 Pekka Paalanen :
> From: Pekka Paalanen 
>
> Add more sanity checks to get_ivi_shell_surface() just in case.
>
> If the configure hook is set, we must always have non-NULL
> configure_private.
>
> Check the ivi_shell_surface matches the surface.
>
> Signed-off-by: Pekka Paalanen 
> ---
>  ivi-shell/ivi-shell.c | 12 +---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
> index d136f46..c502c74 100644
> --- a/ivi-shell/ivi-shell.c
> +++ b/ivi-shell/ivi-shell.c
> @@ -81,10 +81,16 @@ ivi_shell_surface_configure(struct weston_surface *, 
> int32_t, int32_t);
>  static struct ivi_shell_surface *
>  get_ivi_shell_surface(struct weston_surface *surface)
>  {
> -   if (surface->configure == ivi_shell_surface_configure)
> -   return surface->configure_private;
> +   struct ivi_shell_surface *shsurf;
> +
> +   if (surface->configure != ivi_shell_surface_configure)
> +   return NULL;
> +
> +   shsurf = surface->configure_private;
> +   assert(shsurf);
> +   assert(shsurf->surface == surface);
>
> -   return NULL;
> +   return shsurf;
>  }
>
>  void
> --
> 2.7.3
>
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Looks good
Reviewed-by: Eugen Friedrich 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston 4/5] ivi-shell: harden get_ivi_shell_surface()

2016-03-22 Thread Pekka Paalanen
From: Pekka Paalanen 

Add more sanity checks to get_ivi_shell_surface() just in case.

If the configure hook is set, we must always have non-NULL
configure_private.

Check the ivi_shell_surface matches the surface.

Signed-off-by: Pekka Paalanen 
---
 ivi-shell/ivi-shell.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
index d136f46..c502c74 100644
--- a/ivi-shell/ivi-shell.c
+++ b/ivi-shell/ivi-shell.c
@@ -81,10 +81,16 @@ ivi_shell_surface_configure(struct weston_surface *, 
int32_t, int32_t);
 static struct ivi_shell_surface *
 get_ivi_shell_surface(struct weston_surface *surface)
 {
-   if (surface->configure == ivi_shell_surface_configure)
-   return surface->configure_private;
+   struct ivi_shell_surface *shsurf;
+
+   if (surface->configure != ivi_shell_surface_configure)
+   return NULL;
+
+   shsurf = surface->configure_private;
+   assert(shsurf);
+   assert(shsurf->surface == surface);
 
-   return NULL;
+   return shsurf;
 }
 
 void
-- 
2.7.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel