[Mesa-dev] [PATCH] glx: Fix image size computation for EXT_texture_integer

Adam Jackson ajax at redhat.com
Fri Dec 12 10:34:04 PST 2014


Without this, this extension basically can't work in indirect contexts,
TexImage2D will compute the image size as 0 and we'll send no image data
to the server.  Old servers would do undefined things upon receipt of
such a teximage; new servers with the fix for CVE-2014-8098 will correctly
reject the request without this patch.

This is the client-side equivalent of:

http://cgit.freedesktop.org/xorg/xserver/commit/?id=13d36923e0ddb077f4854e354c3d5c80590b5d9d

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 src/glx/compsize.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/glx/compsize.c b/src/glx/compsize.c
index 99c7763..8055919 100644
--- a/src/glx/compsize.c
+++ b/src/glx/compsize.c
@@ -65,6 +65,8 @@ __glElementsPerGroup(GLenum format, GLenum type)
    switch (format) {
    case GL_RGB:
    case GL_BGR:
+   case GL_RGB_INTEGER_EXT:
+   case GL_BGR_INTEGER_EXT:
       return 3;
    case GL_RG:
    case GL_422_EXT:
@@ -74,10 +76,13 @@ __glElementsPerGroup(GLenum format, GLenum type)
    case GL_DEPTH_STENCIL_NV:
    case GL_YCBCR_422_APPLE:
    case GL_LUMINANCE_ALPHA:
+   case GL_LUMINANCE_ALPHA_INTEGER_EXT:
       return 2;
    case GL_RGBA:
    case GL_BGRA:
    case GL_ABGR_EXT:
+   case GL_RGBA_INTEGER_EXT:
+   case GL_BGRA_INTEGER_EXT:
       return 4;
    case GL_COLOR_INDEX:
    case GL_STENCIL_INDEX:
@@ -88,6 +93,11 @@ __glElementsPerGroup(GLenum format, GLenum type)
    case GL_ALPHA:
    case GL_LUMINANCE:
    case GL_INTENSITY:
+   case GL_RED_INTEGER_EXT:
+   case GL_GREEN_INTEGER_EXT:
+   case GL_BLUE_INTEGER_EXT:
+   case GL_ALPHA_INTEGER_EXT:
+   case GL_LUMINANCE_INTEGER_EXT:
       return 1;
    default:
       return 0;
-- 
1.9.3



More information about the mesa-dev mailing list