[PATCH] glamor: Fix stack corruption, glGet on GL_MAX_VIEWPORT_DIMS returns two values

Markus Wick markus at selfnet.de
Mon Jun 30 12:57:44 PDT 2014


Oh, how did I miss this ...

Reviewed-by: Markus Wick <markus at selfnet.de>

Am 2014-06-28 21:27, schrieb Tomasz Borowik:
> From 0a6d1c900b6d5559c50c703480a479a59689b8be Mon Sep 17 00:00:00 2001
> From: timon37 <timon37 at gmail.com>
> Date: Sat, 28 Jun 2014 21:26:27 +0200
> Subject: [PATCH] glamor: Fix stack corruption in glamor_init, glGet on
>  GL_MAX_VIEWPORT_DIMS returns two values
> 
> ---
>  glamor/glamor.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/glamor/glamor.c b/glamor/glamor.c
> index c398807..3588903 100644
> --- a/glamor/glamor.c
> +++ b/glamor/glamor.c
> @@ -316,7 +316,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
>  {
>      glamor_screen_private *glamor_priv;
>      int gl_version;
> -    int max_viewport_size;
> +    int max_viewport_size[2];
> 
>  #ifdef RENDER
>      PictureScreenPtr ps = GetPictureScreenIfSet(screen);
> @@ -408,8 +408,9 @@ glamor_init(ScreenPtr screen, unsigned int flags)
>      glamor_priv->has_buffer_storage =
>          epoxy_has_gl_extension("GL_ARB_buffer_storage");
>      glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glamor_priv->max_fbo_size);
> -    glGetIntegerv(GL_MAX_VIEWPORT_DIMS, &max_viewport_size);
> -    glamor_priv->max_fbo_size = MIN(glamor_priv->max_fbo_size,
> max_viewport_size);
> +    glGetIntegerv(GL_MAX_VIEWPORT_DIMS, max_viewport_size);
> +    glamor_priv->max_fbo_size = MIN(glamor_priv->max_fbo_size,
> max_viewport_size[0]);
> +    glamor_priv->max_fbo_size = MIN(glamor_priv->max_fbo_size,
> max_viewport_size[1]);
>  #ifdef MAX_FBO_SIZE
>      glamor_priv->max_fbo_size = MAX_FBO_SIZE;
>  #endif


More information about the xorg-devel mailing list