diff --git a/src/messages/Image.cpp b/src/messages/Image.cpp index 9147bbea6..1b4f11645 100644 --- a/src/messages/Image.cpp +++ b/src/messages/Image.cpp @@ -406,9 +406,10 @@ void Image::actuallyLoad() buffer.open(QIODevice::ReadOnly); QImageReader reader(&buffer); - if (reader.size().width() * reader.size().height() * - reader.imageCount() * 4 > - Image::maxBytesRam) + // use "double" to prevent int overflows + if (double(reader.size().width()) * double(reader.size().height()) * + double(reader.imageCount()) * 4.0 > + double(Image::maxBytesRam)) { qCDebug(chatterinoImage) << "image too large in RAM";