Skip to content

Commit

Permalink
Fix CID 1158180 Argument cannot be negative
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Jul 1, 2018
1 parent 13ec8a7 commit 53795a8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/opencl/openclwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,17 @@ static ds_status readProFile(const char* fileName, char** content,
status = DS_FILE_ERROR;
} else {
fseek(input, 0L, SEEK_END);
size_t size = ftell(input);
long pos = ftell(input);
rewind(input);
char* binary = new char[size];
if (fread(binary, sizeof(char), size, input) != size) {
status = DS_FILE_ERROR;
} else {
*contentSize = size;
*content = binary;
if (pos > 0) {
size_t size = pos;
char *binary = new char[size];
if (fread(binary, sizeof(char), size, input) != size) {
status = DS_FILE_ERROR;
} else {
*contentSize = size;
*content = binary;
}
}
fclose(input);
}
Expand Down

0 comments on commit 53795a8

Please sign in to comment.