Commit 866faaaf authored by Michael Reeves's avatar Michael Reeves

Fix integer overflow.

Prevent line count from exceeding maximum value in
SourceData::FileData::preprocess
parent 90bf629a
......@@ -584,7 +584,7 @@ bool SourceData::FileData::preprocess(bool bPreserveCR, QTextCodec* pEncoding)
if(pCodec != pEncoding)
skipBytes = 0;
if(m_size - skipBytes > INT_MAX)
if(m_size - skipBytes > TYPE_MAX(QtNumberType))
return false;
QByteArray ba = QByteArray::fromRawData(m_pBuf + skipBytes, (int)(m_size - skipBytes));
......@@ -604,6 +604,9 @@ bool SourceData::FileData::preprocess(bool bPreserveCR, QTextCodec* pEncoding)
{
if(i >= ucSize || p[i] == '\n')
{
if(lines >= TYPE_MAX(LineCount) - 5)
return false;
++lines;
}
if(p[i].isNull())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment