Commit 6eb5baec authored by Maik Qualmann's avatar Maik Qualmann


parent d9167290
......@@ -103,7 +103,7 @@ public:
static qint64 checkAllocation(qint64 fullSize);
template <typename Type> static Type* new_failureTolerant(size_t unsecureSize);
template <typename Type> static Type* new_failureTolerant(quint64 w, quint64 h, uint typesPerPixel);
template <typename Type> static Type* new_failureTolerant(uint w, uint h, uint typesPerPixel);
......@@ -156,14 +156,14 @@ private:
* 32bit overflow and exceeding the size_t type
template <typename Type>
Q_INLINE_TEMPLATE Type* DImgLoader::new_failureTolerant(quint64 w, quint64 h, uint typesPerPixel)
Q_INLINE_TEMPLATE Type* DImgLoader::new_failureTolerant(uint w, uint h, uint typesPerPixel)
quint64 requested = w * h * quint64(typesPerPixel);
quint64 requested = (quint64)w * (quint64)h * (quint64)typesPerPixel;
quint64 maximum = std::numeric_limits<size_t>::max();
if (requested > maximum)
qCCritical(DIGIKAM_DIMG_LOG) << "Requested memory of" << requested*quint64(sizeof(Type))
qCCritical(DIGIKAM_DIMG_LOG) << "Requested memory of" << requested * quint64(sizeof(Type))
<< "is larger than size_t supported by platform.";
return nullptr;
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