From 13f96c5401ffe3869f08fecb2baf5bff2438b02e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 10 Nov 2008 14:27:42 -0700 Subject: 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. --- src/mesa/glapi/dispatch.h | 3 --- src/mesa/glapi/gl_API.xml | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src/mesa/glapi') 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 @@ - + @@ -8645,7 +8645,7 @@ - + -- cgit v1.2.3 From 59cc9739400c3a1654c069586070ff218993cd37 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 10 Nov 2008 14:42:02 -0700 Subject: mesa: fix some misc breakage caused by editing auto-generated files rather than the python generators Specifically: #include "glapitable.h" in src/mesa/main/glapi/dispatch.h Call _mesa_bsearch() in src/mesa/main/enums.c. --- src/mesa/glapi/dispatch.h | 2 ++ src/mesa/glapi/gl_enums.py | 12 ++++++++---- src/mesa/glapi/gl_table.py | 4 +++- src/mesa/main/enums.c | 12 ++++++++---- 4 files changed, 21 insertions(+), 9 deletions(-) (limited to 'src/mesa/glapi') diff --git a/src/mesa/glapi/dispatch.h b/src/mesa/glapi/dispatch.h index 7123156085..f019aa6aaf 100644 --- a/src/mesa/glapi/dispatch.h +++ b/src/mesa/glapi/dispatch.h @@ -28,6 +28,8 @@ #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_enums.py b/src/mesa/glapi/gl_enums.py index 0e3c57042a..67fec7968a 100644 --- a/src/mesa/glapi/gl_enums.py +++ b/src/mesa/glapi/gl_enums.py @@ -96,8 +96,10 @@ const char *_mesa_lookup_enum_by_nr( int nr ) { unsigned * i; - i = (unsigned *)bsearch( & nr, reduced_enums, Elements(reduced_enums), - sizeof(reduced_enums[0]), (cfunc) compar_nr ); + i = (unsigned *) _mesa_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 ]; @@ -114,8 +116,10 @@ int _mesa_lookup_enum_by_name( const char *symbol ) enum_elt * f = NULL; if ( symbol != NULL ) { - f = (enum_elt *)bsearch( symbol, all_enums, Elements(all_enums), - sizeof( enum_elt ), (cfunc) compar_name ); + f = (enum_elt *) _mesa_bsearch(symbol, all_enums, + Elements(all_enums), + sizeof( enum_elt ), + (cfunc) compar_name); } return (f != NULL) ? f->n : -1; diff --git a/src/mesa/glapi/gl_table.py b/src/mesa/glapi/gl_table.py index 7023a4b71a..55a33748ae 100644 --- a/src/mesa/glapi/gl_table.py +++ b/src/mesa/glapi/gl_table.py @@ -78,7 +78,9 @@ class PrintRemapTable(gl_XML.gl_print_base): def printRealHeader(self): - print """/** + print """ +#include "glapitable.h" +/** * \\file dispatch.h * Macros for handling GL dispatch tables. * diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index a9c102e4f2..4796f3027a 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -4866,8 +4866,10 @@ const char *_mesa_lookup_enum_by_nr( int nr ) { unsigned * i; - i = (unsigned *)bsearch( & nr, reduced_enums, Elements(reduced_enums), - sizeof(reduced_enums[0]), (cfunc) compar_nr ); + i = (unsigned *) _mesa_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 +4886,10 @@ int _mesa_lookup_enum_by_name( const char *symbol ) enum_elt * f = NULL; if ( symbol != NULL ) { - f = (enum_elt *)bsearch( symbol, all_enums, Elements(all_enums), - sizeof( enum_elt ), (cfunc) compar_name ); + f = (enum_elt *) _mesa_bsearch(symbol, all_enums, + Elements(all_enums), + sizeof( enum_elt ), + (cfunc) compar_name); } return (f != NULL) ? f->n : -1; -- cgit v1.2.3 From 8df4f6667f2892368791ae25505a996bc0edfacb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 10 Nov 2008 16:38:47 -0700 Subject: mesa: restore glapi/ prefix on #include --- src/mesa/drivers/dri/common/extension_helper.h | 2 +- src/mesa/glapi/extension_helper.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/glapi') diff --git a/src/mesa/drivers/dri/common/extension_helper.h b/src/mesa/drivers/dri/common/extension_helper.h index 65e96657b8..b977ebf015 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 "dispatch.h" +#include "glapi/dispatch.h" #ifndef NULL # define NULL 0 diff --git a/src/mesa/glapi/extension_helper.py b/src/mesa/glapi/extension_helper.py index f7fa90c390..375e3ea59e 100644 --- a/src/mesa/glapi/extension_helper.py +++ b/src/mesa/glapi/extension_helper.py @@ -151,7 +151,7 @@ class PrintGlExtensionGlue(gl_XML.gl_print_base): def printRealHeader(self): print '#include "utils.h"' - print '#include "dispatch.h"' + print '#include "glapi/dispatch.h"' print '' return -- cgit v1.2.3