From 9f7011b88bd8dfeb0ddeed65c4c1ef39ad44798a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 17 Aug 2002 00:26:29 +0000 Subject: added error checking for glCallLists() type parameter --- src/mesa/main/dlist.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 07687e4dab..deb4995ff1 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.92 2002/06/30 15:47:00 brianp Exp $ */ +/* $Id: dlist.c,v 1.93 2002/08/17 00:26:29 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -520,7 +520,7 @@ void _mesa_init_lists( void ) InstSize[OPCODE_BLEND_FUNC] = 3; InstSize[OPCODE_BLEND_FUNC_SEPARATE] = 5; InstSize[OPCODE_CALL_LIST] = 2; - InstSize[OPCODE_CALL_LIST_OFFSET] = 2; + InstSize[OPCODE_CALL_LIST_OFFSET] = 3; InstSize[OPCODE_CLEAR] = 2; InstSize[OPCODE_CLEAR_ACCUM] = 5; InstSize[OPCODE_CLEAR_COLOR] = 5; @@ -898,14 +898,34 @@ void _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) { GET_CURRENT_CONTEXT(ctx); GLint i; + GLboolean typeErrorFlag; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); FLUSH_CURRENT(ctx, 0); + switch (type) { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + case GL_2_BYTES: + case GL_3_BYTES: + case GL_4_BYTES: + typeErrorFlag = GL_FALSE; + break; + default: + typeErrorFlag = GL_TRUE; + } + for (i=0;iExecuteFlag) { @@ -4201,7 +4221,11 @@ execute_list( GLcontext *ctx, GLuint list ) break; case OPCODE_CALL_LIST_OFFSET: /* Generated by glCallLists() so we must add ListBase */ - if (ctx->CallDepthCallDepth < MAX_LIST_NESTING) { execute_list( ctx, ctx->List.ListBase + n[1].ui ); } break; @@ -5059,6 +5083,24 @@ _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "_mesa_CallLists %d\n", n); + switch (type) { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + case GL_2_BYTES: + case GL_3_BYTES: + case GL_4_BYTES: + /* OK */ + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)"); + return; + } + /* Save the CompileFlag status, turn it off, execute display list, * and restore the CompileFlag. */ -- cgit v1.2.3