and add assertions to prevent buffer overflow. This fixes corruption
of the si_shader struct.
NOTE: This is a candidate for the 9.1 branch.
[ Cherry-pick of r600g commit
da33f9b919039442e9ab51f9b1d1c83a73607133 ]
Reviewed-by: Marek Olšák <maraeo@gmail.com>
switch (d->Declaration.File) {
case TGSI_FILE_INPUT:
i = shader->ninput++;
+ assert(i < Elements(shader->input));
shader->input[i].name = d->Semantic.Name;
shader->input[i].sid = d->Semantic.Index;
shader->input[i].interpolate = d->Interp.Interpolate;
case TGSI_FILE_OUTPUT:
i = shader->noutput++;
+ assert(i < Elements(shader->output));
shader->output[i].name = d->Semantic.Name;
shader->output[i].sid = d->Semantic.Index;
shader->output[i].interpolate = d->Interp.Interpolate;
struct si_shader {
unsigned ninput;
- struct si_shader_io input[32];
+ struct si_shader_io input[40];
unsigned noutput;
- struct si_shader_io output[32];
+ struct si_shader_io output[40];
unsigned ninterp;
bool uses_kill;