OSDN Git Service

unicoder.cpp: Fix crash when comparing files that the size of the file is less than...
authorsdottaka <sdottaka@sourceforge.net>
Thu, 22 May 2014 17:37:01 +0000 (02:37 +0900)
committersdottaka <sdottaka@sourceforge.net>
Thu, 22 May 2014 17:37:01 +0000 (02:37 +0900)
--HG--
branch : stable

Src/Common/unicoder.cpp

index 52b54f1..254dfdd 100644 (file)
@@ -1168,6 +1168,8 @@ bool CheckForInvalidUtf8(const char *pBuffer, size_t size)
                        return true;
                pVal2++;
        }
+       if (size <= 3)
+               return false;
        pVal2 = (unsigned char *)pBuffer;
        bool bUTF8 = false;
        for (int i = 0; i < (size - 3); ++i)