From 5c4c05257cd89ab4a082169db3f15c9998f79135 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Fri, 20 Sep 2019 22:41:19 +0200 Subject: [PATCH] xcf: Fix regression when reading files with "unsupported" properties Summary: The fact that we don't know the property is most of the times not fatal, so what we have to do is just "skip" the property and hope for the best BUGS: 411327 Reviewers: cfeck, apol, vkrause Reviewed By: vkrause Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D24114 --- src/imageformats/xcf.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/imageformats/xcf.cpp b/src/imageformats/xcf.cpp index b6dc0b2..c1f730c 100644 --- a/src/imageformats/xcf.cpp +++ b/src/imageformats/xcf.cpp @@ -485,9 +485,15 @@ bool XCFImageFormat::loadImageProperties(QDataStream &xcf_io, XCFImage &xcf_imag * \return true if there were no IO errors. */ bool XCFImageFormat::loadProperty(QDataStream &xcf_io, PropType &type, QByteArray &bytes, quint32 &rawType) { + quint32 size; + xcf_io >> rawType; if (rawType >= MAX_SUPPORTED_PROPTYPE) { type = MAX_SUPPORTED_PROPTYPE; + // we don't support the property, but we still need to read from the device, assume it's like all the + // non custom properties that is data_length + data + xcf_io >> size; + xcf_io.skipRawData(size); // return true because we don't really want to totally fail on an unsupported property since it may not be fatal return true; } @@ -495,7 +501,6 @@ bool XCFImageFormat::loadProperty(QDataStream &xcf_io, PropType &type, QByteArra type = PropType(rawType); char *data = nullptr; - quint32 size; // The colormap property size is not the correct number of bytes: // The GIMP source xcf.c has size = 4 + ncolors, but it should be