[Spice-devel] [PATCH spice] Validate RedDrawable bbox before allocating drawable

Christophe Fergeau cfergeau at redhat.com
Fri Oct 24 06:23:33 PDT 2014


Hey,

On Fri, Oct 24, 2014 at 03:10:29PM +0200, Marc-André Lureau wrote:
> Avoid unnecessary allocation (and possibly leaking) if the RedDrawable
> doesn't validate_drawable_bbox()
> 
> Related to: rhbz#1135372
> ---
>  server/red_worker.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/server/red_worker.c b/server/red_worker.c
> index e177b68..d56db35 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -4068,6 +4068,11 @@ static Drawable *get_drawable(RedWorker *worker, uint8_t effect, RedDrawable *re
>      struct timespec time;
>      int x;
>  

You'll need to move the
VALIDATE_SURFACE_RETVAL(worker, drawable->surface_id, NULL);
check before calling  validate_drawable_bbox() (or into that call).

> +    if (!validate_drawable_bbox(worker, red_drawable)) {
> +        rendering_incorrect(__func__);
> +        return NULL;
> +    }
> +


Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20141024/1b6d2104/attachment.sig>


More information about the Spice-devel mailing list