[Mesa-dev] [Mesa-stable] [PATCH] glsl: do not attempt assignment if operand type not parsed correctly

Tapani Pälli tapani.palli at intel.com
Mon Sep 24 13:53:53 UTC 2018



On 9/24/18 4:38 PM, Ian Romanick wrote:
> On 09/24/2018 06:23 AM, Tapani Pälli wrote:
>> Cc: mesa-stable at lists.freedesktop.org
>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108012
>> ---
>>   src/compiler/glsl/ast_to_hir.cpp | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
>> index 93e7c8ec334..1b0ea1282b7 100644
>> --- a/src/compiler/glsl/ast_to_hir.cpp
>> +++ b/src/compiler/glsl/ast_to_hir.cpp
>> @@ -1685,6 +1685,11 @@ ast_expression::do_hir(exec_list *instructions,
>>         op[1] = this->subexpressions[1]->hir(instructions, state);
>>   
>>         orig_type = op[0]->type;
>> +
>> +      /* Break out if op[0] type has not been parsed successfully. */
> 
> Should we also bail of op[1]->type is error?  We tried to keep going
> when there were some errors, but I don't know if that has any chance of
> being useful in either of these cases.

In that case it is actually safe to continue, since the bug occurs when 
we clone op[0] (when calling do_assignment). But maybe for completeness 
this check should be changed to:

if ((op[0]->type == glsl_type::error_type || op[1]->type == 
glsl_type::error_type))

?


>> +      if (orig_type == glsl_type::error_type)
>> +         break;
>> +
>>         type = arithmetic_result_type(op[0], op[1],
>>                                       (this->oper == ast_mul_assign),
>>                                       state, & loc);
>>
> 


More information about the mesa-dev mailing list