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.
This commit is contained in:
@@ -4748,7 +4748,15 @@ asm_instruction_ctor(gl_inst_opcode op,
|
|||||||
if (inst) {
|
if (inst) {
|
||||||
_mesa_init_instructions(& inst->Base, 1);
|
_mesa_init_instructions(& inst->Base, 1);
|
||||||
inst->Base.Opcode = op;
|
inst->Base.Opcode = op;
|
||||||
|
|
||||||
|
/* 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.DstReg = *dst;
|
||||||
|
}
|
||||||
|
|
||||||
inst->Base.SrcReg[0] = src0->Base;
|
inst->Base.SrcReg[0] = src0->Base;
|
||||||
inst->SrcReg[0] = *src0;
|
inst->SrcReg[0] = *src0;
|
||||||
|
@@ -1879,7 +1879,15 @@ asm_instruction_ctor(gl_inst_opcode op,
|
|||||||
if (inst) {
|
if (inst) {
|
||||||
_mesa_init_instructions(& inst->Base, 1);
|
_mesa_init_instructions(& inst->Base, 1);
|
||||||
inst->Base.Opcode = op;
|
inst->Base.Opcode = op;
|
||||||
|
|
||||||
|
/* 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.DstReg = *dst;
|
||||||
|
}
|
||||||
|
|
||||||
inst->Base.SrcReg[0] = src0->Base;
|
inst->Base.SrcReg[0] = src0->Base;
|
||||||
inst->SrcReg[0] = *src0;
|
inst->SrcReg[0] = *src0;
|
||||||
|
Reference in New Issue
Block a user