summaryrefslogtreecommitdiffstats
path: root/src/plugins/imageformats/tga/qtgafile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/imageformats/tga/qtgafile.cpp')
-rw-r--r--src/plugins/imageformats/tga/qtgafile.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/imageformats/tga/qtgafile.cpp b/src/plugins/imageformats/tga/qtgafile.cpp
index 97510df..5d086c6 100644
--- a/src/plugins/imageformats/tga/qtgafile.cpp
+++ b/src/plugins/imageformats/tga/qtgafile.cpp
@@ -163,6 +163,12 @@ QTgaFile::QTgaFile(QIODevice *device)
if (!validDepth)
{
mErrorMessage = tr("Image depth not valid");
+ return;
+ }
+ if (quint64(width()) * quint64(height()) > (8192 * 8192))
+ {
+ mErrorMessage = tr("Image size exceeds limit");
+ return;
}
int curPos = mDevice->pos();
int fileBytes = mDevice->size();
@@ -233,6 +239,8 @@ QImage QTgaFile::readImage()
unsigned char yCorner = desc & 0x20; // 0 = lower, 1 = upper
QImage im(imageWidth, imageHeight, QImage::Format_ARGB32);
+ if (im.isNull())
+ return QImage();
TgaReader *reader = 0;
if (bitsPerPixel == 16)
reader = new Tga16Reader();