diff options
author | Luca Barbieri <[email protected]> | 2010-09-05 17:57:12 +0200 |
---|---|---|
committer | Luca Barbieri <[email protected]> | 2010-09-05 17:57:12 +0200 |
commit | 029c1815717ea62bae28e86798c86dfa98cbc8a7 (patch) | |
tree | b91da49168dcfa1f59502ec761042f5ecaba974f /src/mesa | |
parent | 9a77d0471a655b2903a9e2696aa91b4b92267583 (diff) |
mesa: don't smash the stack in _mesa_find_used_registers
At some point this actually triggered, not sure if it still does.
Give a meaningful assert and refuse to smash the stack anyway.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/program/program.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c index 3b6d6827446..06b9539bda6 100644 --- a/src/mesa/program/program.c +++ b/src/mesa/program/program.c @@ -876,12 +876,16 @@ _mesa_find_used_registers(const struct gl_program *prog, const GLuint n = _mesa_num_inst_src_regs(inst->Opcode); if (inst->DstReg.File == file) { - used[inst->DstReg.Index] = GL_TRUE; + ASSERT(inst->DstReg.Index < usedSize); + if(inst->DstReg.Index < usedSize) + used[inst->DstReg.Index] = GL_TRUE; } for (j = 0; j < n; j++) { if (inst->SrcReg[j].File == file) { - used[inst->SrcReg[j].Index] = GL_TRUE; + ASSERT(inst->SrcReg[j].Index < usedSize); + if(inst->SrcReg[j].Index < usedSize) + used[inst->SrcReg[j].Index] = GL_TRUE; } } } |