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
This commit is contained in:
Albert Astals Cid 2019-09-20 22:41:19 +02:00
parent 7afaacb093
commit 5c4c05257c

View File

@ -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