diff options
author | Brian Paul <[email protected]> | 2006-08-24 15:57:12 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2006-08-24 15:57:12 +0000 |
commit | 116411d5f00dd4af6bb2da3a98d57ca6fa2c1d82 (patch) | |
tree | 1ce788490f405dbb55d2a135c4c01de99b0fc741 /src/mesa/drivers | |
parent | 4169c220bdd65bb5a35ab50ae467ab9076f8c4f9 (diff) |
Check if mesa_vp->Base.Parameters is null before dereferencing (bug report
from Chris Rankin).
Also, fix some bad casts.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_vertprog.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index eaed68e7c8e..203bce143b4 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -101,7 +101,7 @@ static GLboolean r200VertexProgUpdateParams(GLcontext *ctx, struct r200_vertex_p r200ContextPtr rmesa = R200_CONTEXT( ctx ); GLfloat *fcmd = (GLfloat *)&rmesa->hw.vpp[0].cmd[VPP_CMD_0 + 1]; int pi; - struct gl_vertex_program *mesa_vp = (void *)vp; + struct gl_vertex_program *mesa_vp = &vp->mesa_program; struct gl_program_parameter_list *paramList; drm_radeon_cmd_header_t tmp; @@ -391,7 +391,7 @@ static unsigned long op_operands(enum prog_opcode opcode) static GLboolean r200_translate_vertex_program(struct r200_vertex_program *vp) { - struct gl_vertex_program *mesa_vp = (void *)vp; + struct gl_vertex_program *mesa_vp = &vp->mesa_program; struct prog_instruction *vpi; int i; VERTEX_SHADER_INSTRUCTION *o_inst; @@ -544,7 +544,10 @@ static GLboolean r200_translate_vertex_program(struct r200_vertex_program *vp) vp->pos_end = 0; mesa_vp->Base.NumNativeInstructions = 0; - mesa_vp->Base.NumNativeParameters = mesa_vp->Base.Parameters->NumParameters; + if (mesa_vp->Base.Parameters) + mesa_vp->Base.NumNativeParameters = mesa_vp->Base.Parameters->NumParameters; + else + mesa_vp->Base.NumNativeParameters = 0; for(i=0; i < VERT_ATTRIB_MAX; i++) vp->inputs[i] = -1; |