mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
test_compiler_defines_for_extensions: fix overflow (#1430)
GCC 11.2.0 warns about a possible string overflow (when num_not_supported_extensions+num_of_supported_extensions == 0) since no space would be allocated for the terminating null byte that string manipulation fns expect to find. This unconditionally adds an extra byte to the allocation to silence the warning and fix building with -Werror.
This commit is contained in:
@@ -322,8 +322,15 @@ int test_compiler_defines_for_extensions(cl_device_id device, cl_context context
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build the kernel
|
// Build the kernel
|
||||||
char *kernel_code = (char*)malloc(1025*256*(num_not_supported_extensions+num_of_supported_extensions));
|
char *kernel_code = (char *)malloc(
|
||||||
memset(kernel_code, 0, 1025*256*(num_not_supported_extensions+num_of_supported_extensions));
|
1
|
||||||
|
+ 1025 * 256
|
||||||
|
* (num_not_supported_extensions + num_of_supported_extensions));
|
||||||
|
memset(
|
||||||
|
kernel_code, 0,
|
||||||
|
1
|
||||||
|
+ 1025 * 256
|
||||||
|
* (num_not_supported_extensions + num_of_supported_extensions));
|
||||||
|
|
||||||
int i, index = 0;
|
int i, index = 0;
|
||||||
strcat(kernel_code, kernel_strings[0]);
|
strcat(kernel_code, kernel_strings[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user