[Mesa-dev] [PATCH] ac: fix buffer overflow bug in 64bit SSBO loads

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Thu Jan 18 01:07:58 UTC 2018


On Thu, Jan 18, 2018 at 1:46 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
>
>
> On 18/01/18 11:35, Bas Nieuwenhuizen wrote:
>>
>> On Tue, Jan 16, 2018 at 7:45 AM, Timothy Arceri <tarceri at itsqueeze.com>
>> wrote:
>>>
>>> Fixes: 441ee1e65b04 "radv/ac: Implement Float64 SSBO loads"
>>> ---
>>>   src/amd/common/ac_nir_to_llvm.c | 5 ++++-
>>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/amd/common/ac_nir_to_llvm.c
>>> b/src/amd/common/ac_nir_to_llvm.c
>>> index 6467ed66ae..4a80748e4e 100644
>>> --- a/src/amd/common/ac_nir_to_llvm.c
>>> +++ b/src/amd/common/ac_nir_to_llvm.c
>>> @@ -2585,8 +2585,11 @@ static LLVMValueRef visit_load_buffer(struct
>>> ac_nir_context *ctx,
>>>                          ctx->ac.i1false,
>>>                  };
>>>
>>> -               results[i] = ac_build_intrinsic(&ctx->ac, load_name,
>>> data_type, params, 5, 0);
>>> +               int idx = i;
>>> +               if (instr->dest.ssa.bit_size == 64)
>>> +                       idx = i > 1 ? 1 : 0;
>>>
>>> +               results[idx] = ac_build_intrinsic(&ctx->ac, load_name,
>>> data_type, params, 5, 0);
>>
>>
>> Can't we just simplify this into results[i > 0 ? 1 : 0] always?
>
>
> Yeah probably, that patch was a little sloppy although I've already pushed
> it. I can push a clean up with your r-b if you like?

Yeah if you do that, it would be reviewed-by me.

>
>
>>
>>>          }
>>>
>>>          assume(results[0]);
>>> --
>>> 2.14.3
>>>
>>> _______________________________________________
>>> 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