clover: Use cl_ulong in the maximum allocation size calculation to avoid overflow.

This commit is contained in:
Francisco Jerez 2014-01-14 21:38:11 +01:00
parent 8c4a9f631d
commit e457aca7fa

View file

@ -37,7 +37,7 @@ clCreateBuffer(cl_context d_ctx, cl_mem_flags flags, size_t size,
throw error(CL_INVALID_HOST_PTR);
if (!size ||
size > fold(maximum(), 0u,
size > fold(maximum(), cl_ulong(0),
map(std::mem_fn(&device::max_mem_alloc_size), ctx.devs())
))
throw error(CL_INVALID_BUFFER_SIZE);