File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -303,9 +303,25 @@ static inline void* clGetExtensionFunctionAddressForPlatform_body(
303303 // to get the extension function address.
304304
305305 KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR (platform , NULL );
306+
307+ #define KHR_ICD_REJECT_EXTENSION_FUNCTION (name ) \
308+ do \
309+ { \
310+ if (!strcmp(function_name, #name)) \
311+ { \
312+ return NULL; \
313+ } \
314+ } while (0)
315+
316+ // Reject ICD-specific functions that could be misused by users
317+ KHR_ICD_REJECT_EXTENSION_FUNCTION (clIcdGetPlatformIDsKHR );
318+ KHR_ICD_REJECT_EXTENSION_FUNCTION (clIcdGetFunctionAddressForPlatformKHR );
319+ KHR_ICD_REJECT_EXTENSION_FUNCTION (clIcdSetPlatformDispatchDataKHR );
320+
306321 return KHR_ICD2_DISPATCH (platform )-> clGetExtensionFunctionAddressForPlatform (
307322 platform ,
308323 function_name );
324+ #undef KHR_ICD_REJECT_EXTENSION_FUNCTION
309325}
310326
311327void * CL_API_CALL clGetExtensionFunctionAddressForPlatform_disp (
You can’t perform that action at this time.
0 commit comments