fix for crash in compositor/opencl, the error value of -1001 would read past the error-string array.

This commit is contained in:
Campbell Barton
2013-08-17 07:09:07 +00:00
parent d7cc2be2b7
commit 1b11428101

View File

@@ -313,7 +313,8 @@ void WorkScheduler::initialize(bool use_opencl)
cl_uint numberOfPlatforms = 0; cl_uint numberOfPlatforms = 0;
cl_int error; cl_int error;
error = clGetPlatformIDs(0, 0, &numberOfPlatforms); error = clGetPlatformIDs(0, 0, &numberOfPlatforms);
if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } if (error == -1001) { } /* GPU not supported */
else if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
if (G.f & G_DEBUG) printf("%d number of platforms\n", numberOfPlatforms); if (G.f & G_DEBUG) printf("%d number of platforms\n", numberOfPlatforms);
cl_platform_id *platforms = (cl_platform_id *)MEM_mallocN(sizeof(cl_platform_id) * numberOfPlatforms, __func__); cl_platform_id *platforms = (cl_platform_id *)MEM_mallocN(sizeof(cl_platform_id) * numberOfPlatforms, __func__);
error = clGetPlatformIDs(numberOfPlatforms, platforms, 0); error = clGetPlatformIDs(numberOfPlatforms, platforms, 0);