mirror of
https://github.com/AxioDL/tinyxml2.git
synced 2025-06-05 22:23:33 +00:00
Ensure file contents fit into size_t range
This commit is contained in:
parent
882e89e601
commit
2a8b1f5789
@ -1846,6 +1846,12 @@ XMLError XMLDocument::LoadFile( FILE* fp )
|
|||||||
return _errorID;
|
return _errorID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( filelength >= (size_t)-1 ) {
|
||||||
|
// Cannot handle files which won't fit in buffer together with null terminator
|
||||||
|
SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 );
|
||||||
|
return _errorID;
|
||||||
|
}
|
||||||
|
|
||||||
const size_t size = filelength;
|
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 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user