coverity#1158180 Argument cannot be negative
Change-Id: Ic8dd6aeff02b08c8a3951ce0378eab95ba0c6f1d
This commit is contained in:
parent
cbff9d45e4
commit
d93c204f37
@ -347,6 +347,7 @@ inline ds_status readProFile(const char* fileName, char** content, size_t* conte
|
||||
FILE* input = NULL;
|
||||
size_t size = 0;
|
||||
char* binary = NULL;
|
||||
long pos = -1;
|
||||
|
||||
*contentSize = 0;
|
||||
*content = NULL;
|
||||
@ -358,7 +359,14 @@ inline ds_status readProFile(const char* fileName, char** content, size_t* conte
|
||||
}
|
||||
|
||||
fseek(input, 0L, SEEK_END);
|
||||
size = ftell(input);
|
||||
pos = ftell(input);
|
||||
if (pos < 0)
|
||||
{
|
||||
fclose(input);
|
||||
return DS_FILE_ERROR;
|
||||
}
|
||||
|
||||
size = pos;
|
||||
rewind(input);
|
||||
binary = (char*)malloc(size);
|
||||
if (binary == NULL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user