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

Tomasz Borowik timon37 at gmail.com
Sat Jun 28 12:27:29 PDT 2014


>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
-- 
2.0.0


More information about the xorg-devel mailing list