diff options
Diffstat (limited to 'mesalib/src/mesa/vbo')
-rw-r--r-- | mesalib/src/mesa/vbo/vbo_attrib_tmp.h | 13 | ||||
-rw-r--r-- | mesalib/src/mesa/vbo/vbo_exec_api.c | 7 |
2 files changed, 19 insertions, 1 deletions
diff --git a/mesalib/src/mesa/vbo/vbo_attrib_tmp.h b/mesalib/src/mesa/vbo/vbo_attrib_tmp.h index 65717eb45..e1023834a 100644 --- a/mesalib/src/mesa/vbo/vbo_attrib_tmp.h +++ b/mesalib/src/mesa/vbo/vbo_attrib_tmp.h @@ -809,6 +809,12 @@ TAG(Materialfv)(GLenum face, GLenum pname, const GLfloat * params) { GET_CURRENT_CONTEXT(ctx); + + if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { + _mesa_error(ctx, GL_INVALID_ENUM, "glMaterial(invalid face)"); + return; + } + switch (pname) { case GL_EMISSION: MAT(VBO_ATTRIB_MAT_FRONT_EMISSION, 4, face, params); @@ -823,7 +829,12 @@ TAG(Materialfv)(GLenum face, GLenum pname, MAT(VBO_ATTRIB_MAT_FRONT_SPECULAR, 4, face, params); break; case GL_SHININESS: - MAT(VBO_ATTRIB_MAT_FRONT_SHININESS, 1, face, params); + if (*params < 0 || *params > ctx->Const.MaxShininess) + _mesa_error(ctx, GL_INVALID_VALUE, + "glMaterial(invalid shininess: %f out range [0, %f])", + *params, ctx->Const.MaxShininess); + else + MAT(VBO_ATTRIB_MAT_FRONT_SHININESS, 1, face, params); break; case GL_COLOR_INDEXES: MAT(VBO_ATTRIB_MAT_FRONT_INDEXES, 3, face, params); diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c index cad7c4639..150589bec 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_api.c +++ b/mesalib/src/mesa/vbo/vbo_exec_api.c @@ -42,6 +42,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/light.h" #include "main/api_arrayelt.h" #include "main/api_noop.h" +#include "main/api_validate.h" #include "main/dispatch.h" #include "vbo_context.h" @@ -552,6 +553,7 @@ static void GLAPIENTRY vbo_exec_EvalPoint2( GLint i, GLint j ) #endif /* FEATURE_evaluators */ + /** * Called via glBegin. */ @@ -563,6 +565,11 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode ) struct vbo_exec_context *exec = &vbo_context(ctx)->exec; int i; + if (!_mesa_valid_prim_mode(ctx, mode)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBegin"); + return; + } + if (ctx->NewState) { _mesa_update_state( ctx ); |