qUncompress: make a narrowing conversion explicit
... and add an assertion. The assertion can only trigger if our definition of MaxDecompressedSize is wrong. Pick-to: 6.4 6.3 6.2 Task-number: QTBUG-104972 Change-Id: Ifa375f59fb6ff5e0324d2208f4c2882174f9a44d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>bb10
parent
91d7dcea11
commit
454f4679ef
|
|
@ -633,7 +633,8 @@ QByteArray qUncompress(const uchar* data, qsizetype nbytes)
|
|||
if (len > MaxDecompressedSize)
|
||||
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…
Reference in New Issue