mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
fix overflows in the max image size code (#2950)
* fix overflows in the max image size code * Update Image.cpp
This commit is contained in:
parent
6830e8b01b
commit
804bc526b5
1 changed files with 4 additions and 3 deletions
|
@ -406,9 +406,10 @@ void Image::actuallyLoad()
|
||||||
buffer.open(QIODevice::ReadOnly);
|
buffer.open(QIODevice::ReadOnly);
|
||||||
QImageReader reader(&buffer);
|
QImageReader reader(&buffer);
|
||||||
|
|
||||||
if (reader.size().width() * reader.size().height() *
|
// use "double" to prevent int overflows
|
||||||
reader.imageCount() * 4 >
|
if (double(reader.size().width()) * double(reader.size().height()) *
|
||||||
Image::maxBytesRam)
|
double(reader.imageCount()) * 4.0 >
|
||||||
|
double(Image::maxBytesRam))
|
||||||
{
|
{
|
||||||
qCDebug(chatterinoImage) << "image too large in RAM";
|
qCDebug(chatterinoImage) << "image too large in RAM";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue