aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/program_parse.tab.c
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2009-07-30 09:41:35 -0700
committerIan Romanick <[email protected]>2009-07-30 09:41:35 -0700
commit17534ab88ce29119f79de8abfcc4170471e8f5a4 (patch)
tree8b146f525b89373b2e9c39e0917053f36c881dfa /src/mesa/shader/program_parse.tab.c
parent600710907c5b72cf33e0b3ca6dc7e0d2a1a8ab25 (diff)
ARB prog parser: Prevent NULL ptr deref for KIL instruction
The KIL instruction doesn't have a destination register, so dereferencing dst in asm_instruction_ctor would cause a segfault.
Diffstat (limited to 'src/mesa/shader/program_parse.tab.c')
-rw-r--r--src/mesa/shader/program_parse.tab.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c
index 1d071988974..9b4c4e82775 100644
--- a/src/mesa/shader/program_parse.tab.c
+++ b/src/mesa/shader/program_parse.tab.c
@@ -4748,7 +4748,15 @@ asm_instruction_ctor(gl_inst_opcode op,
if (inst) {
_mesa_init_instructions(& inst->Base, 1);
inst->Base.Opcode = op;
- inst->Base.DstReg = *dst;
+
+ /* In the core ARB extensions only the KIL instruction doesn't have a
+ * destination register.
+ */
+ if (dst == NULL) {
+ init_dst_reg(& inst->Base.DstReg);
+ } else {
+ inst->Base.DstReg = *dst;
+ }
inst->Base.SrcReg[0] = src0->Base;
inst->SrcReg[0] = *src0;