mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 00:40:09 +01:00
svga: fix invalid memory reference in needs_to_create_zero()
The emit->key.fkey info is only valid if we're generating a fragment shader. We should not look at it if we're generating a vertex shader. When generating a vertex shader, the value of emit->key.fkey.num_textures was garbage and the loop over num_textures would read invalid data. At best this would cause us to emit an unused constant. At worse, we could segfault. Just by dumb luck, fkey.num_textures was usually a smallish integer. NOTE: This is a candidate for the 8.0 branch. Reviewed-by: José Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
38184dcd54
commit
dafa77201f
1 changed files with 5 additions and 5 deletions
|
|
@ -3126,6 +3126,11 @@ needs_to_create_zero( struct svga_shader_emitter *emit )
|
|||
emit->key.fkey.tex[i].swizzle_a > PIPE_SWIZZLE_ALPHA)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < emit->key.fkey.num_textures; i++) {
|
||||
if (emit->key.fkey.tex[i].compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (emit->unit == PIPE_SHADER_VERTEX) {
|
||||
|
|
@ -3150,11 +3155,6 @@ needs_to_create_zero( struct svga_shader_emitter *emit )
|
|||
emit->info.opcode_count[TGSI_OPCODE_KILP] >= 1)
|
||||
return TRUE;
|
||||
|
||||
for (i = 0; i < emit->key.fkey.num_textures; i++) {
|
||||
if (emit->key.fkey.tex[i].compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue