fix(gpu): fix an overflow that may happen when the user tries to allocate a huge amount of blocks

This commit is contained in:
Pedro Alves
2025-09-16 10:48:29 -03:00
committed by Pedro Alves
parent ffd7470ef1
commit becd08db71

View File

@@ -19,7 +19,7 @@ void create_zero_radix_ciphertext_async(cudaStream_t const stream,
radix->lwe_dimension = lwe_dimension;
radix->num_radix_blocks = num_radix_blocks;
radix->max_num_radix_blocks = num_radix_blocks;
uint32_t size = (lwe_dimension + 1) * num_radix_blocks * sizeof(Torus);
uint64_t size = (lwe_dimension + 1) * num_radix_blocks * sizeof(Torus);
radix->ptr = (void *)cuda_malloc_with_size_tracking_async(
size, stream, gpu_index, size_tracker, allocate_gpu_memory);
cuda_memset_with_size_tracking_async(radix->ptr, 0, size, stream, gpu_index,