Hello community, here is the log from the commit of package kimageformats for openSUSE:Factory checked in at 2019-03-21 09:46:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kimageformats (Old) and /work/SRC/openSUSE:Factory/.kimageformats.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kimageformats" Thu Mar 21 09:46:14 2019 rev:66 rq:686746 version:5.56.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kimageformats/kimageformats.changes 2019-02-28 21:30:33.833789418 +0100 +++ /work/SRC/openSUSE:Factory/.kimageformats.new.28833/kimageformats.changes 2019-03-21 09:46:20.694896923 +0100 @@ -1,0 +2,22 @@ +Sun Mar 10 20:15:36 UTC 2019 - [email protected] + +- Update to 5.56.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.56.0.php +- Changes since 5.55.0: + * ras: fix crash on broken files + * Use auto here too + * compile without foreach + * ras: protect the palette QVector too + * ras: tweak max file check + * xcf: Fix uninitialized memory use on broken documents + * add const, helps understand the function better + * ras: tweak max size that "fits" in a QVector + * ras: don't assert because we try to allicate a huge vector + * ras: Protect against divide by zero + * xcf: Don't divide by 0 + * tga: fail gracefully if readRawData errors + * ras: fail gracefully on height*width*bpp > length + +------------------------------------------------------------------- Old: ---- kimageformats-5.55.0.tar.xz New: ---- kimageformats-5.56.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kimageformats.spec ++++++ --- /var/tmp/diff_new_pack.6Hm5I9/_old 2019-03-21 09:46:22.214896573 +0100 +++ /var/tmp/diff_new_pack.6Hm5I9/_new 2019-03-21 09:46:22.246896566 +0100 @@ -16,13 +16,13 @@ # -%define _tar_path 5.55 +%define _tar_path 5.56 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} Name: kimageformats -Version: 5.55.0 +Version: 5.56.0 Release: 0 Summary: Image format plugins for Qt License: LGPL-2.1-or-later ++++++ kimageformats-5.55.0.tar.xz -> kimageformats-5.56.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kimageformats-5.55.0/CMakeLists.txt new/kimageformats-5.56.0/CMakeLists.txt --- old/kimageformats-5.55.0/CMakeLists.txt 2019-02-02 18:22:00.000000000 +0100 +++ new/kimageformats-5.56.0/CMakeLists.txt 2019-03-02 14:27:12.000000000 +0100 @@ -3,7 +3,7 @@ project(KImageFormats) include(FeatureSummary) -find_package(ECM 5.55.0 NO_MODULE) +find_package(ECM 5.56.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) @@ -45,7 +45,7 @@ TYPE OPTIONAL PURPOSE "Required for the QImage plugin for OpenEXR images" ) - +add_definitions(-DQT_NO_FOREACH) add_subdirectory(src) if (BUILD_TESTING) add_subdirectory(autotests) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kimageformats-5.55.0/autotests/readtest.cpp new/kimageformats-5.56.0/autotests/readtest.cpp --- old/kimageformats-5.55.0/autotests/readtest.cpp 2019-02-02 18:22:00.000000000 +0100 +++ new/kimageformats-5.56.0/autotests/readtest.cpp 2019-03-02 14:27:12.000000000 +0100 @@ -127,7 +127,8 @@ << "Starting basic read tests for " << suffix << " images *********\n"; - foreach (QFileInfo fi, imgdir.entryInfoList()) { + const QFileInfoList lstImgDir = imgdir.entryInfoList(); + for (const QFileInfo &fi : lstImgDir) { int suffixPos = fi.filePath().count() - suffix.count(); QString inputfile = fi.filePath(); QString expfile = fi.filePath().replace(suffixPos, suffix.count(), QStringLiteral("png")); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kimageformats-5.55.0/autotests/writetest.cpp new/kimageformats-5.56.0/autotests/writetest.cpp --- old/kimageformats-5.55.0/autotests/writetest.cpp 2019-02-02 18:22:00.000000000 +0100 +++ new/kimageformats-5.56.0/autotests/writetest.cpp 2019-03-02 14:27:12.000000000 +0100 @@ -73,8 +73,8 @@ QTextStream(stdout) << "********* " << "Starting basic write tests for " << suffix << " images *********\n"; - - foreach (QFileInfo fi, imgdir.entryInfoList()) { + const QFileInfoList lstImgDir = imgdir.entryInfoList(); + for (const QFileInfo &fi : lstImgDir) { int suffixPos = fi.filePath().count() - suffix.count(); QString pngfile = fi.filePath().replace(suffixPos, suffix.count(), QStringLiteral("png")); QString pngfilename = QFileInfo(pngfile).fileName(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kimageformats-5.55.0/src/imageformats/pic.cpp new/kimageformats-5.56.0/src/imageformats/pic.cpp --- old/kimageformats-5.55.0/src/imageformats/pic.cpp 2019-02-02 18:22:00.000000000 +0100 +++ new/kimageformats-5.56.0/src/imageformats/pic.cpp 2019-03-02 14:27:12.000000000 +0100 @@ -173,9 +173,9 @@ return s; } -static bool readRow(QDataStream &stream, QRgb *row, quint16 width, QList<PicChannel> channels) +static bool readRow(QDataStream &stream, QRgb *row, quint16 width, const QList<PicChannel> &channels) { - Q_FOREACH(const PicChannel &channel, channels) { + for(const PicChannel &channel : channels) { auto readPixel = [&] (QDataStream &str) -> QRgb { quint8 red = 0; if (channel.code & RED) { @@ -242,7 +242,7 @@ } QImage::Format fmt = QImage::Format_RGB32; - Q_FOREACH(const PicChannel &channel, m_channels) { + for (const PicChannel &channel : qAsConst(m_channels)) { if (channel.size != 8) { // we cannot read images that do not come in bytes qDebug() << "Channel size was" << channel.size; @@ -388,8 +388,8 @@ break; case Description: { m_description.clear(); - QStringList entries = value.toString().split(QStringLiteral("\n\n")); - Q_FOREACH(const QString entry, entries) { + const QStringList entries = value.toString().split(QStringLiteral("\n\n")); + for (const QString &entry : entries) { if (entry.startsWith(QStringLiteral("Description: "))) { m_description = entry.mid(13).simplified().toUtf8(); } @@ -425,7 +425,7 @@ return QString(); case ImageFormat: if (const_cast<SoftimagePICHandler*>(this)->readChannels()) { - Q_FOREACH (const PicChannel &channel, m_channels) { + for (const PicChannel &channel : qAsConst(m_channels)) { if (channel.code & ALPHA) { return QImage::Format_ARGB32; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kimageformats-5.55.0/src/imageformats/ras.cpp new/kimageformats-5.56.0/src/imageformats/ras.cpp --- old/kimageformats-5.55.0/src/imageformats/ras.cpp 2019-02-02 18:22:00.000000000 +0100 +++ new/kimageformats-5.56.0/src/imageformats/ras.cpp 2019-03-02 14:27:12.000000000 +0100 @@ -102,6 +102,13 @@ static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img) { s.device()->seek(RasHeader::SIZE); + + // QVector uses some extra space for stuff, hence the 32 here suggested by thiago + if (ras.ColorMapLength > std::numeric_limits<int>::max() - 32) { + qWarning() << "LoadRAS() unsupported image color map length in file header" << ras.ColorMapLength; + return false; + } + // Read palette if needed. QVector<quint8> palette(ras.ColorMapLength); if (ras.ColorMapType == 1) { @@ -110,9 +117,26 @@ } } + const int bpp = ras.Depth / 8; + if (ras.Height == 0) { + return false; + } + if (bpp == 0) { + return false; + } + if (ras.Length / ras.Height / bpp < ras.Width) { + qWarning() << "LoadRAS() mistmatch between height and width" << ras.Width << ras.Height << ras.Length << ras.Depth; + return false; + } + // QVector uses some extra space for stuff, hence the 32 here suggested by thiago + if (ras.Length > std::numeric_limits<int>::max() - 32) { + qWarning() << "LoadRAS() unsupported image length in file header" << ras.Length; + return false; + } + // each line must be a factor of 16 bits, so they may contain padding // this will be 1 if padding required, 0 otherwise - int paddingrequired = (ras.Width * (ras.Depth / 8) % 2); + const int paddingrequired = (ras.Width * bpp % 2); // qDebug() << "paddingrequired: " << paddingrequired; // don't trust ras.Length @@ -122,7 +146,7 @@ while (! s.atEnd()) { s >> input[i]; // I guess we need to find out if we're at the end of a line - if (paddingrequired && i != 0 && !(i % (ras.Width * (ras.Depth / 8)))) { + if (paddingrequired && i != 0 && !(i % (ras.Width * bpp))) { s >> input[i]; } i++; @@ -140,9 +164,9 @@ quint8 red, green, blue; for (quint32 y = 0; y < ras.Height; y++) { for (quint32 x = 0; x < ras.Width; x++) { - red = palette[(int)input[y * ras.Width + x]]; - green = palette[(int)input[y * ras.Width + x] + (ras.ColorMapLength / 3)]; - blue = palette[(int)input[y * ras.Width + x] + 2 * (ras.ColorMapLength / 3)]; + red = palette.value((int)input[y * ras.Width + x]); + green = palette.value((int)input[y * ras.Width + x] + (ras.ColorMapLength / 3)); + blue = palette.value((int)input[y * ras.Width + x] + 2 * (ras.ColorMapLength / 3)); img.setPixel(x, y, qRgb(red, green, blue)); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kimageformats-5.55.0/src/imageformats/tga.cpp new/kimageformats-5.56.0/src/imageformats/tga.cpp --- old/kimageformats-5.55.0/src/imageformats/tga.cpp 2019-02-02 18:22:00.000000000 +0100 +++ new/kimageformats-5.56.0/src/imageformats/tga.cpp 2019-03-02 14:27:12.000000000 +0100 @@ -206,6 +206,9 @@ // @todo Support palettes in other formats! const int size = 3 * tga.colormap_length; const int dataRead = s.readRawData(palette, size); + if (dataRead < 0) { + return false; + } if (dataRead < size) { memset(&palette[dataRead], 0, size - dataRead); } @@ -260,6 +263,10 @@ } else { // Read raw image. const int dataRead = s.readRawData((char *)image, size); + if (dataRead < 0) { + free(image); + return false; + } if (dataRead < size) { memset(&image[dataRead], 0, size - dataRead); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kimageformats-5.55.0/src/imageformats/xcf.cpp new/kimageformats-5.56.0/src/imageformats/xcf.cpp --- old/kimageformats-5.55.0/src/imageformats/xcf.cpp 2019-02-02 18:22:00.000000000 +0100 +++ new/kimageformats-5.56.0/src/imageformats/xcf.cpp 2019-03-02 14:27:12.000000000 +0100 @@ -901,7 +901,7 @@ void XCFImageFormat::assignImageBytes(Layer &layer, uint i, uint j) { QImage &image = layer.image_tiles[j][i]; - uchar *tile = layer.tile; + const uchar *tile = layer.tile; const int width = image.width(); const int height = image.height(); const int bytesPerLine = image.bytesPerLine(); @@ -1063,6 +1063,13 @@ xcf_io >> width >> height >> offset; if (offset == 0) { + // offset 0 with rowsxcols != 0 is probably an error since it means we have tiles + // without data but just clear the bits for now instead of returning false + for (uint j = 0; j < layer.nrows; j++) { + for (uint i = 0; i < layer.ncols; i++) { + layer.image_tiles[j][i].fill(Qt::transparent); + } + } return true; } @@ -2214,7 +2221,7 @@ uchar new_r, new_g, new_b, new_a; new_a = dst_a + INT_MULT(OPAQUE_OPACITY - dst_a, src_a); - float src_ratio = (float)src_a / new_a; + const float src_ratio = new_a == 0 ? 1.0 : (float)src_a / new_a; float dst_ratio = 1.0 - src_ratio; new_r = (uchar)(src_ratio * src_r + dst_ratio * dst_r + EPSILON); @@ -2373,7 +2380,7 @@ uchar new_a = OPAQUE_OPACITY; - float src_ratio = (float)src_a / new_a; + const float src_ratio = new_a == 0 ? 1.0 : (float)src_a / new_a; float dst_ratio = 1.0 - src_ratio; uchar new_g = (uchar)(src_ratio * src + dst_ratio * dst + EPSILON); @@ -2546,7 +2553,7 @@ uchar new_a = dst_a + INT_MULT(OPAQUE_OPACITY - dst_a, src_a); - float src_ratio = (float)src_a / new_a; + const float src_ratio = new_a == 0 ? 1.0 : (float)src_a / new_a; float dst_ratio = 1.0 - src_ratio; uchar new_g = (uchar)(src_ratio * src + dst_ratio * dst + EPSILON); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kimageformats-5.55.0/tests/imageconverter.cpp new/kimageformats-5.56.0/tests/imageconverter.cpp --- old/kimageformats-5.55.0/tests/imageconverter.cpp 2019-02-02 18:22:00.000000000 +0100 +++ new/kimageformats-5.56.0/tests/imageconverter.cpp 2019-03-02 14:27:12.000000000 +0100 @@ -64,11 +64,13 @@ if (parser.isSet(listformats)) { QTextStream out(stdout); out << "Input formats:\n"; - foreach (const QByteArray &fmt, QImageReader::supportedImageFormats()) { + const auto lstReaderSupportedFormats = QImageReader::supportedImageFormats(); + for (const QByteArray &fmt : lstReaderSupportedFormats) { out << " " << fmt << '\n'; } out << "Output formats:\n"; - foreach (const QByteArray &fmt, QImageWriter::supportedImageFormats()) { + const auto lstWriterSupportedFormats = QImageWriter::supportedImageFormats(); + for (const QByteArray &fmt : lstWriterSupportedFormats) { out << " " << fmt << '\n'; } return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kimageformats-5.55.0/tests/imagedump.cpp new/kimageformats-5.56.0/tests/imagedump.cpp --- old/kimageformats-5.55.0/tests/imagedump.cpp 2019-02-02 18:22:00.000000000 +0100 +++ new/kimageformats-5.56.0/tests/imagedump.cpp 2019-03-02 14:27:12.000000000 +0100 @@ -72,7 +72,8 @@ if (parser.isSet(listformats)) { QTextStream out(stdout); out << "File formats:\n"; - foreach (const QByteArray &fmt, QImageReader::supportedImageFormats()) { + const auto lstSupportedFormats = QImageReader::supportedImageFormats(); + for (const auto &fmt : lstSupportedFormats) { out << " " << fmt << '\n'; } return 0;
