summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-11-10 14:27:42 -0700
committerBrian Paul <brian.paul@tungstengraphics.com>2008-11-10 14:27:42 -0700
commit13f96c5401ffe3869f08fecb2baf5bff2438b02e (patch)
treea7b3e9c73b980cb9cb744d656c918eea69a3f66b /src/mesa
parent6186e7a20676c5df30b1b4bffeec87afa1550e25 (diff)
GLX: fix out-of-bounds memory issue in indirect glAreTexturesResident()
See bug 18445. When getting array results, __glXReadReply() always reads a multiple of four bytes. This can cause writing to invalid memory when 'n' is not a multiple of four. Special-case the glAreTexturesResident() functions now. To fix the bug, we use a temporary buffer that's a multiple of four bytes in length. NOTE: this commit also reverts part of commit 919ec22ecf72aa163e1b97d8c7381002131ed32c (glx/x11: Added some #ifdef GLX_DIRECT_RENDERING protection) which directly edited the indirect.c file rather than the python generator! I'm not repairing that issue at this time.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/common/extension_helper.h34
-rw-r--r--src/mesa/glapi/dispatch.h3
-rw-r--r--src/mesa/glapi/gl_API.xml4
-rw-r--r--src/mesa/main/enums.c8
4 files changed, 23 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/common/extension_helper.h b/src/mesa/drivers/dri/common/extension_helper.h
index 3143ea2b10..65e96657b8 100644
--- a/src/mesa/drivers/dri/common/extension_helper.h
+++ b/src/mesa/drivers/dri/common/extension_helper.h
@@ -26,7 +26,7 @@
*/
#include "utils.h"
-#include "glapi/dispatch.h"
+#include "dispatch.h"
#ifndef NULL
# define NULL 0
@@ -1077,6 +1077,13 @@ static const char AreTexturesResident_names[] =
"";
#endif
+#if defined(need_GL_EXT_framebuffer_object)
+static const char IsRenderbufferEXT_names[] =
+ "i\0" /* Parameter signature */
+ "glIsRenderbufferEXT\0"
+ "";
+#endif
+
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ATI_separate_stencil)
static const char StencilOpSeparate_names[] =
"iiii\0" /* Parameter signature */
@@ -1756,6 +1763,13 @@ static const char DeleteFencesNV_names[] =
"";
#endif
+#if defined(need_GL_SGIX_polynomial_ffd)
+static const char DeformationMap3dSGIX_names[] =
+ "iddiiddiiddiip\0" /* Parameter signature */
+ "glDeformationMap3dSGIX\0"
+ "";
+#endif
+
#if defined(need_GL_VERSION_2_0)
static const char IsShader_names[] =
"i\0" /* Parameter signature */
@@ -2001,13 +2015,6 @@ static const char WeightfvARB_names[] =
"";
#endif
-#if defined(need_GL_EXT_framebuffer_object)
-static const char IsRenderbufferEXT_names[] =
- "i\0" /* Parameter signature */
- "glIsRenderbufferEXT\0"
- "";
-#endif
-
#if defined(need_GL_MESA_window_pos)
static const char WindowPos4fMESA_names[] =
"ffff\0" /* Parameter signature */
@@ -4523,13 +4530,6 @@ static const char Minmax_names[] =
"";
#endif
-#if defined(need_GL_SGIX_polynomial_ffd)
-static const char DeformationMap3dSGIX_names[] =
- "iddiiddiiddiip\0" /* Parameter signature */
- "glDeformationMap3dSGIX\0"
- "";
-#endif
-
#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
static const char FogCoorddvEXT_names[] =
"p\0" /* Parameter signature */
@@ -5319,13 +5319,13 @@ static const struct dri_extension_function GL_EXT_framebuffer_blit_functions[] =
#if defined(need_GL_EXT_framebuffer_object)
static const struct dri_extension_function GL_EXT_framebuffer_object_functions[] = {
{ GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, -1 },
+ { IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 },
{ RenderbufferStorageEXT_names, RenderbufferStorageEXT_remap_index, -1 },
{ CheckFramebufferStatusEXT_names, CheckFramebufferStatusEXT_remap_index, -1 },
{ DeleteRenderbuffersEXT_names, DeleteRenderbuffersEXT_remap_index, -1 },
{ FramebufferTexture3DEXT_names, FramebufferTexture3DEXT_remap_index, -1 },
{ FramebufferRenderbufferEXT_names, FramebufferRenderbufferEXT_remap_index, -1 },
{ FramebufferTexture1DEXT_names, FramebufferTexture1DEXT_remap_index, -1 },
- { IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 },
{ BindFramebufferEXT_names, BindFramebufferEXT_remap_index, -1 },
{ GenRenderbuffersEXT_names, GenRenderbuffersEXT_remap_index, -1 },
{ IsFramebufferEXT_names, IsFramebufferEXT_remap_index, -1 },
@@ -5965,9 +5965,9 @@ static const struct dri_extension_function GL_SGIX_pixel_texture_functions[] = {
#if defined(need_GL_SGIX_polynomial_ffd)
static const struct dri_extension_function GL_SGIX_polynomial_ffd_functions[] = {
{ LoadIdentityDeformationMapSGIX_names, LoadIdentityDeformationMapSGIX_remap_index, -1 },
+ { DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 },
{ DeformSGIX_names, DeformSGIX_remap_index, -1 },
{ DeformationMap3fSGIX_names, DeformationMap3fSGIX_remap_index, -1 },
- { DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 },
{ NULL, 0, 0 }
};
#endif
diff --git a/src/mesa/glapi/dispatch.h b/src/mesa/glapi/dispatch.h
index 98f654f402..7123156085 100644
--- a/src/mesa/glapi/dispatch.h
+++ b/src/mesa/glapi/dispatch.h
@@ -28,9 +28,6 @@
#if !defined( _DISPATCH_H_ )
# define _DISPATCH_H_
-#include "glapitable.h"
-
-
/**
* \file dispatch.h
* Macros for handling GL dispatch tables.
diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml
index 2d8a967ba7..6c0367aad7 100644
--- a/src/mesa/glapi/gl_API.xml
+++ b/src/mesa/glapi/gl_API.xml
@@ -3289,7 +3289,7 @@
<param name="textures" type="const GLuint *" count="n"/>
<param name="residences" type="GLboolean *" output="true" count="n"/>
<return type="GLboolean"/>
- <glx sop="143" always_array="true"/>
+ <glx sop="143" handcode="client" always_array="true"/>
</function>
<function name="BindTexture" offset="307">
@@ -8645,7 +8645,7 @@
<param name="textures" type="const GLuint *" count="n"/>
<param name="residences" type="GLboolean *" output="true" count="n"/>
<return type="GLboolean"/>
- <glx vendorpriv="11" always_array="true"/>
+ <glx vendorpriv="11" handcode="client" always_array="true"/>
</function>
<function name="BindTextureEXT" alias="BindTexture">
diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c
index 15e7d5b96c..a9c102e4f2 100644
--- a/src/mesa/main/enums.c
+++ b/src/mesa/main/enums.c
@@ -4866,8 +4866,8 @@ const char *_mesa_lookup_enum_by_nr( int nr )
{
unsigned * i;
- i = (unsigned *)_mesa_bsearch( & nr, reduced_enums, Elements(reduced_enums),
- sizeof(reduced_enums[0]), (cfunc) compar_nr );
+ i = (unsigned *)bsearch( & nr, reduced_enums, Elements(reduced_enums),
+ sizeof(reduced_enums[0]), (cfunc) compar_nr );
if ( i != NULL ) {
return & enum_string_table[ all_enums[ *i ].offset ];
@@ -4884,8 +4884,8 @@ int _mesa_lookup_enum_by_name( const char *symbol )
enum_elt * f = NULL;
if ( symbol != NULL ) {
- f = (enum_elt *)_mesa_bsearch( symbol, all_enums, Elements(all_enums),
- sizeof( enum_elt ), (cfunc) compar_name );
+ f = (enum_elt *)bsearch( symbol, all_enums, Elements(all_enums),
+ sizeof( enum_elt ), (cfunc) compar_name );
}
return (f != NULL) ? f->n : -1;