diff options
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qimage_conversions.cpp | 5 | ||||
-rw-r--r-- | src/gui/image/qppmhandler.cpp | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 519885b437..e1d3101174 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -1144,7 +1144,7 @@ static QVector<QRgb> fix_color_table(const QVector<QRgb> &ctbl, QImage::Format f if (format == QImage::Format_RGB32) { // check if the color table has alpha for (int i = 0; i < colorTable.size(); ++i) - if (qAlpha(colorTable.at(i) != 0xff)) + if (qAlpha(colorTable.at(i)) != 0xff) colorTable[i] = colorTable.at(i) | 0xff000000; } else if (format == QImage::Format_ARGB32_Premultiplied) { // check if the color table has alpha @@ -1746,8 +1746,9 @@ static void convert_Indexed8_to_X32(QImageData *dest, const QImageData *src, Qt: if (colorTable.size() < 256) { int tableSize = colorTable.size(); colorTable.resize(256); + QRgb fallbackColor = (dest->format == QImage::Format_RGB32) ? 0xff000000 : 0; for (int i=tableSize; i<256; ++i) - colorTable[i] = 0; + colorTable[i] = fallbackColor; } int w = src->width; diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp index e9f5a905f0..53e3fa293d 100644 --- a/src/gui/image/qppmhandler.cpp +++ b/src/gui/image/qppmhandler.cpp @@ -115,7 +115,7 @@ static bool read_pbm_header(QIODevice *device, char& type, int& w, int& h, int& else mcc = read_pbm_int(device); // get max color component - if (w <= 0 || w > 32767 || h <= 0 || h > 32767 || mcc <= 0) + if (w <= 0 || w > 32767 || h <= 0 || h > 32767 || mcc <= 0 || mcc > 0xffff) return false; // weird P.M image return true; |