From b30be14b3e158489f7d12482a61f5f8ba896d9bf Mon Sep 17 00:00:00 2001 From: MPCBBishop Date: Sat, 20 Jan 2024 18:58:16 +0800 Subject: [PATCH] Fix access violation in some certain conditions --- source/par2j/lib_opencl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/par2j/lib_opencl.c b/source/par2j/lib_opencl.c index 455cd17..6283edc 100644 --- a/source/par2j/lib_opencl.c +++ b/source/par2j/lib_opencl.c @@ -242,7 +242,7 @@ int init_OpenCL(unsigned int unit_size, int *src_max) } alloc_max = 0; - for (i = 0; i < (int)num_platforms; i++){ + for (i = 0; i < (int)min(num_platforms, MAX_DEVICE); i++){ #ifdef DEBUG_OUTPUT // 環境の情報表示 if (fn_clGetPlatformInfo(platform_id[i], CL_PLATFORM_NAME, sizeof(buf), buf, NULL) == CL_SUCCESS)