mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
warn on negative data size from qCompress() function
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
81948e43d7
commit
8a08a87708
1 changed files with 4 additions and 3 deletions
|
@ -405,13 +405,14 @@ QByteArray qCompress(const uchar* data, int nbytes, int compressionLevel)
|
|||
#ifdef QT_FAST_COMPRESS
|
||||
return qFastCompress(reinterpret_cast<const char*>(data), nbytes, compressionLevel);
|
||||
#else
|
||||
if (nbytes == 0) {
|
||||
return QByteArray(4, '\0');
|
||||
}
|
||||
if (Q_UNLIKELY(!data)) {
|
||||
qWarning("qCompress: Data is null");
|
||||
return QByteArray();
|
||||
} else if (Q_UNLIKELY(nbytes <= 0)) {
|
||||
qWarning("qCompress: Data size is negative or zero");
|
||||
return QByteArray(4, '\0');
|
||||
}
|
||||
|
||||
if (compressionLevel < -1 || compressionLevel > 9)
|
||||
compressionLevel = -1;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue