mirror of https://github.com/AxioDL/tinyxml2.git
Fixed issue 147 (XMLDocument::LoadFile() may crash on non-regular file)
This commit is contained in:
parent
343a5ff3bd
commit
ba4b328b3d
|
@ -1639,6 +1639,13 @@ XMLError XMLDocument::LoadFile( FILE* fp )
|
|||
{
|
||||
Clear();
|
||||
|
||||
fseek( fp, 0, SEEK_SET );
|
||||
fgetc( fp );
|
||||
if ( ferror( fp ) != 0 ) {
|
||||
SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 );
|
||||
return _errorID;
|
||||
}
|
||||
|
||||
fseek( fp, 0, SEEK_END );
|
||||
size_t size = ftell( fp );
|
||||
fseek( fp, 0, SEEK_SET );
|
||||
|
|
Loading…
Reference in New Issue