qUncompress: make a narrowing conversion explicit
... and add an assertion. The assertion can only trigger if our definition of MaxDecompressedSize is wrong. Task-number: QTBUG-104972 Change-Id: Ifa375f59fb6ff5e0324d2208f4c2882174f9a44d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 454f4679ef838f866faf26e8f20c960ae5191795) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
98ef806830
commit
dbffd02feb
@ -638,7 +638,8 @@ QByteArray qUncompress(const uchar* data, qsizetype nbytes)
|
||||
return invalidCompressedData();
|
||||
}
|
||||
|
||||
QByteArray::DataPointer d(QByteArray::Data::allocate(len));
|
||||
Q_ASSERT(len <= size_t((std::numeric_limits<qsizetype>::max)()));
|
||||
QByteArray::DataPointer d(QByteArray::Data::allocate(qsizetype(len)));
|
||||
if (d.data() == nullptr) // allocation failed
|
||||
return invalidCompressedData();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user