commit | ba4b328b3da8ad6d46aa1e78e5facf35b65b13e3 | [log] [tgz] |
---|---|---|
author | Daniel Marjamäki <daniel.marjamaki@gmail.com> | Fri Jan 10 21:37:27 2014 +0100 |
committer | Daniel Marjamäki <daniel.marjamaki@gmail.com> | Fri Jan 10 21:37:27 2014 +0100 |
tree | 9f54ab02b1c4ea917b7972b60b0c31c4d5472b18 | |
parent | 343a5ff3bdd7336644db4080f001759e062c359e [diff] [blame] |
Fixed issue 147 (XMLDocument::LoadFile() may crash on non-regular file)
diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 7e4ff40..4574fb3 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp
@@ -1639,6 +1639,13 @@ { 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 );