diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2020-02-24 12:00:21 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2020-03-12 10:43:20 +0100 |
commit | 6e7fe099f41068aa75fe01e52f1496dfdc12ed79 (patch) | |
tree | 479281137a8f075b2199b10d8032434de23834e9 | |
parent | 884b676bba3b1bae9cee982e8b387b067ea02b24 (diff) |
tiff: do not try to read 32bpc as 16bpc
The header reader would assume that bits per sample above 8 had to be
16, but other values are also possible, so check explicitly.
Fixes: QTBUG-82412
Change-Id: I7f0799de4d4cdc84023a34900aa595a7bf73eca1
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 0c4d4dc12a68124451113e21d2c4fdc5d06d01d0)
-rw-r--r-- | src/plugins/imageformats/tiff/qtiffhandler.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp index e6c7175..2cfdac2 100644 --- a/src/plugins/imageformats/tiff/qtiffhandler.cpp +++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp @@ -275,7 +275,7 @@ bool QTiffHandlerPrivate::readHeaders(QIODevice *device) else if ((grayscale || photometric == PHOTOMETRIC_PALETTE) && bitPerSample == 8 && samplesPerPixel == 1) format = QImage::Format_Indexed8; else if (samplesPerPixel < 4) - if (bitPerSample > 8 && photometric == PHOTOMETRIC_RGB) + if (bitPerSample == 16 && photometric == PHOTOMETRIC_RGB) format = QImage::Format_RGBX64; else format = QImage::Format_RGB32; @@ -291,7 +291,7 @@ bool QTiffHandlerPrivate::readHeaders(QIODevice *device) if (!gotField || !count || extrasamples[0] == EXTRASAMPLE_UNSPECIFIED) premultiplied = false; - if (bitPerSample > 8 && photometric == PHOTOMETRIC_RGB) { + if (bitPerSample == 16 && photometric == PHOTOMETRIC_RGB) { // We read 64-bit raw, so unassoc remains unpremultiplied. if (gotField && count && extrasamples[0] == EXTRASAMPLE_UNASSALPHA) premultiplied = false; |