瀏覽代碼

Merge pull request #410 from Dmitry-Me/assertForFTellReturn

Assert to ensure ftell() behaves as expected by later code
Lee Thomason 10 年之前
父節點
當前提交
c8dad95d44
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      tinyxml2.cpp

+ 1 - 0
tinyxml2.cpp

@@ -1954,6 +1954,7 @@ XMLError XMLDocument::LoadFile( FILE* fp )
         SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 );
         return _errorID;
     }
+    TIXMLASSERT( filelength >= 0 );
 
     if ( !LongFitsIntoSizeTMinusOne<>::Fits( filelength ) ) {
         // Cannot handle files which won't fit in buffer together with null terminator