mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-25 22:14:36 +00:00
Use calloced stack memory for CompilerOptions to ensure sprintf writes to the beginning of the char.
This commit is contained in:
parent
d7aac25489
commit
77e9b1c2e8
5
ocl.c
5
ocl.c
@ -472,7 +472,7 @@ build:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create a cl program executable for all the devices specified */
|
/* create a cl program executable for all the devices specified */
|
||||||
char CompilerOptions[256];
|
char *CompilerOptions = calloc(1, 256);
|
||||||
|
|
||||||
sprintf(CompilerOptions, "-DWORKSIZE=%d -DVECTORS%d",
|
sprintf(CompilerOptions, "-DWORKSIZE=%d -DVECTORS%d",
|
||||||
(int)clState->work_size, clState->preferred_vwidth);
|
(int)clState->work_size, clState->preferred_vwidth);
|
||||||
@ -510,7 +510,10 @@ build:
|
|||||||
} else if (opt_debug)
|
} else if (opt_debug)
|
||||||
applog(LOG_DEBUG, "BFI_INT patch requiring device not found, will not BFI_INT patch");
|
applog(LOG_DEBUG, "BFI_INT patch requiring device not found, will not BFI_INT patch");
|
||||||
|
|
||||||
|
if (opt_debug)
|
||||||
|
applog(LOG_DEBUG, "CompilerOptions: %s", CompilerOptions);
|
||||||
status = clBuildProgram(clState->program, 1, &devices[gpu], CompilerOptions , NULL, NULL);
|
status = clBuildProgram(clState->program, 1, &devices[gpu], CompilerOptions , NULL, NULL);
|
||||||
|
free(CompilerOptions);
|
||||||
|
|
||||||
if (status != CL_SUCCESS) {
|
if (status != CL_SUCCESS) {
|
||||||
applog(LOG_ERR, "Error: Building Program (clBuildProgram)");
|
applog(LOG_ERR, "Error: Building Program (clBuildProgram)");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user