mirror of
https://github.com/AxioDL/tinyxml2.git
synced 2025-05-14 19:31:23 +00:00
Check ftell() result for error code before using it.
This commit is contained in:
parent
fca00d0ebc
commit
acb9c9c260
@ -1695,9 +1695,14 @@ XMLError XMLDocument::LoadFile( FILE* fp )
|
|||||||
}
|
}
|
||||||
|
|
||||||
fseek( fp, 0, SEEK_END );
|
fseek( fp, 0, SEEK_END );
|
||||||
size_t size = ftell( fp );
|
const long filelength = ftell( fp );
|
||||||
fseek( fp, 0, SEEK_SET );
|
fseek( fp, 0, SEEK_SET );
|
||||||
|
if ( filelength == -1L ) {
|
||||||
|
SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 );
|
||||||
|
return _errorID;
|
||||||
|
}
|
||||||
|
|
||||||
|
const size_t size = filelength;
|
||||||
if ( size == 0 ) {
|
if ( size == 0 ) {
|
||||||
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
|
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
|
||||||
return _errorID;
|
return _errorID;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user