[Mesa-dev] [PATCH] glsl: fix segfault when indirect indexing a buffer variable which is an array

Samuel Iglesias Gonsálvez siglesias at igalia.com
Mon Oct 19 02:22:26 PDT 2015



On 19/10/15 11:10, Timothy Arceri wrote:
> On Mon, 2015-10-19 at 11:00 +0200, Samuel Iglesias Gonsalvez wrote:
>> Fixes a regression added by bb5aeb854915ba67abc56257f830d002c956439e.
>>
>> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> 
> Thanks. Reviewed-by: Timothy Arceri <t_arceri at yahoo.com.au>
> 
> I'm surprised this didn't show up in my piglit regression testing.

Me too. I submitted a piglit test to check this.

> 
>> ---
>>
>> Piglit test that checks the regression:
>>   http://patchwork.freedesktop.org/patch/62183/ 
>>
>>  src/glsl/lower_ubo_reference.cpp | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/glsl/lower_ubo_reference.cpp
>> b/src/glsl/lower_ubo_reference.cpp
>> index 1fbb09d..7dcbe15 100644
>> --- a/src/glsl/lower_ubo_reference.cpp
>> +++ b/src/glsl/lower_ubo_reference.cpp
>> @@ -284,7 +284,7 @@ interface_field_name(void *mem_ctx, char
>> *base_name, ir_rvalue *d,
>>              if (array_index->type != glsl_type::uint_type)
>>                 array_index = i2u(array_index);
>>  
>> -            if (a->array->type->fields.array->is_array()) {
>> +            if (a->array->type->is_array() && a->array->type
>> ->fields.array->is_array()) {

By the way, I am going to split the line in two to fulfil the line width
requirement before pushing the patch.

Sam

>>                 ir_constant *base_size = new(mem_ctx)
>>                    ir_constant(a->array->type->fields.array
>> ->arrays_of_arrays_size());
>>                 array_index = mul(array_index, base_size);
> 


More information about the mesa-dev mailing list