summaryrefslogtreecommitdiffstats
path: root/src/plugins/imageformats/jpeg
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2009-06-09 10:02:59 (GMT)
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2009-06-09 10:07:14 (GMT)
commitd826a08add652314bb22bee44e0d43bbd672f272 (patch)
treee47b8ab38ed4773c2b63ea7a5d7ec0f49ed9d061 /src/plugins/imageformats/jpeg
parent9b88c6f485016b53d394a88106a048495cf79294 (diff)
downloadQt-d826a08add652314bb22bee44e0d43bbd672f272.zip
Qt-d826a08add652314bb22bee44e0d43bbd672f272.tar.gz
Qt-d826a08add652314bb22bee44e0d43bbd672f272.tar.bz2
Fix floating point exception in QImageReader::setScaledSize(QSize(0, 0))
Avoid a division by 0 when doing QImageReader::setScaledSize(QSize(0, 0)) for jpeg formats. Reviewed-by: thierry Task-number: 255627
Diffstat (limited to 'src/plugins/imageformats/jpeg')
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 6d0bc1f..088ef97 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -781,7 +781,8 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage,
#ifndef QT_NO_IMAGE_SMOOTHSCALE
// If high quality not required, shrink image during decompression
- if (scaledSize.isValid() && quality < HIGH_QUALITY_THRESHOLD && !params.contains(QLatin1String("GetHeaderInformation")) ) {
+ if (scaledSize.isValid() && !scaledSize.isEmpty() && quality < HIGH_QUALITY_THRESHOLD
+ && !params.contains(QLatin1String("GetHeaderInformation")) ) {
cinfo.scale_denom = qMin(cinfo.image_width / scaledSize.width(),
cinfo.image_width / scaledSize.height());
if (cinfo.scale_denom < 2) {