[Mesa-dev] [PATCH] nir: remove wrong assertion in print_var_decl()

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Wed Jul 25 16:09:57 UTC 2018


On Wed, Jul 25, 2018 at 3:38 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
>
>
> On 07/25/2018 03:28 PM, Bas Nieuwenhuizen wrote:
>>
>> On Wed, Jul 25, 2018 at 2:30 PM, Samuel Pitoiset
>> <samuel.pitoiset at gmail.com> wrote:
>>>
>>> This breaks printing input/output variables with more than
>>> 4 components like mat4.
>>>
>>> Fixes: 1beef89ad8 ("nir: prepare for bumping up max components to 16")
>>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>>> ---
>>>   src/compiler/nir/nir_print.c | 1 -
>>>   1 file changed, 1 deletion(-)
>>>
>>> diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
>>> index 93d1c02f23..7cb16abd14 100644
>>> --- a/src/compiler/nir/nir_print.c
>>> +++ b/src/compiler/nir/nir_print.c
>>> @@ -491,7 +491,6 @@ print_var_decl(nir_variable *var, print_state *state)
>>>         switch (var->data.mode) {
>>>         case nir_var_shader_in:
>>>         case nir_var_shader_out:
>>> -         assert(num_components <= 4);
>>>            if (num_components < 4 && num_components != 0) {
>>>               const char *xyzw = "xyzw";
>>
>>
>> won't you go out of bounds on this array/string if num_components > 4?
>
>
> What? The above condition already prevents that?
True, I'm blind apparently.

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

>
>
>>>               for (int i = 0; i < num_components; i++)
>>> --
>>> 2.18.0
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list