Skip to content
Permalink
Browse files

Merge pull request #257 from GreyMerlin/master

Prevent silent abort with File Comparison of files whose size is an exact multiple of 2^32 bytes
  • Loading branch information
sdottaka committed Jan 26, 2020
2 parents 70d73e3 + 342b864 commit d0ace1195e84a56003ee4e8495226dab8aeb193f
Showing with 2 additions and 2 deletions.
  1. +2 −2 Src/Common/UniFile.cpp
@@ -241,18 +241,18 @@ bool UniMemFile::DoOpen(const String& filename, AccessMode mode)
return false;
m_lineno = -1;

#ifndef _WIN64
unsigned sizehi = (unsigned)(m_filesize >> 32);
unsigned sizelo = (unsigned)(m_filesize & 0xFFFFFFFF);

#ifndef _WIN64
if (sizehi || sizelo > 0x7FFFFFFF)
{
LastErrorCustom(_T("UniMemFile cannot handle files over 2 gigabytes"));
return false;
}
#endif

if (sizelo == 0)
if (m_filesize == 0)
{
// Allow opening empty file, but memory mapping doesn't work on such
// m_base and m_current are 0 from the Close call above

0 comments on commit d0ace11

Please sign in to comment.
You can’t perform that action at this time.