- Added support for `Size` and `Format` options and slightly improved format detection from canRead().
- Removed conversion to ARGB32 on load (improved performace with RGBA images).
- Added result checks on writing.
With this MR, all plugins have minimal support for options.
I ran a stupid fuzzer on all the plugins in the repo and some plugins needs more sanity checks.
- RAS: fixed palette reading on corrupted files
- RGB: improved error detection on datastream
This patch improves the reading speed of some corrupted files and limit the maximum memory allocation of RAS palette.
* speeds up incremental builds as changes to a header will not always
need the full mocs_compilation.cpp for all the target's headers rebuild,
while having a moc file sourced into a source file only adds minor
extra costs, due to small own code and the used headers usually
already covered by the source file, being for the same class/struct
* seems to not slow down clean builds, due to empty mocs_compilation.cpp
resulting in those quickly processed, while the minor extra cost of the
sourced moc files does not outweigh that in summary.
Measured times actually improved by some percent points.
(ideally CMake would just skip empty mocs_compilation.cpp & its object
file one day)
* enables compiler to see all methods of a class in same compilation unit
to do some sanity checks
* potentially more inlining in general, due to more in the compilation unit
* allows to keep using more forward declarations in the header, as with the
moc code being sourced into the cpp file there definitions can be ensured
and often are already for the needs of the normal class methods
To make the plugins fail to allocate if the image size is greater than QImageReader::allocationLimit() it is necessary to allocate the image with QImageIOHandler::allocateImage().
Note that not all plugins have been changed and some others are not tested in the CI (maybe due to missing libraries).
PS: the following message is printed by QImageIOHandler::allocateImage() if the size is exceeded: "qt.gui.imageio: QImageIOHandler: Rejecting image as it exceeds the current allocation limit of XXX megabytes"
According to relicensecheck Brad is OK with changing LGPLv2 to LGPLv2+,
which is required to be compatible with the LGPL-2.1-or-later licensed
source files.
Since QImage does sanity checking for overflows and stuff wrt.
dimensions and depth, check for QImage::isNull() as early as possible to
see if there's some funky business going on.
Also tried to add some checks wherever we wrote to "raw" memory.
Unit tests pass, and tested converting some files from
https://samples.ffmpeg.org/image-samples/ to pngs, and that seemed to
work.
Reviewed By: aacid
Differential Revision: https://phabricator.kde.org/D24367
Summary:
As one can see in SGIImage::readImage the accepted images are
_stream >> u16;
if (u16 != 0x01da) {
return false;
}
_stream >> _rle;
if (_rle > 1) {
return false;
}
so not only \x01\xda\x01 but also \x01\xda\x00
Reviewers: svuorela
Reviewed By: svuorela
Subscribers: svuorela, kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D20145
Summary:
The code is even simpler this way.
Found by using heaptrack.
Test Plan: the unittest for rgb still passes.
Reviewers: cfeck
Reviewed By: cfeck
Subscribers: jtamate, kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D15890
The change to QLatin1String to QStringLiteral had a very nasty
unintended side effect, causing many (but not all) applications to
crash on exit.
Laurent, please be wary with blanket changes on low level code as
they might break things in unexpected ways.
CCMAIL: montel@kde.org
CCMAIL: tittiatcoke@gmail.com
Frameworks have a convention of naming uninstalled headers in src/ with
a _p at the end of the name, to make it clear they are not part of the
API. None of the headers in KImageFormats are installed, so it is not
really necessary to follow this convention, but we follow it anyway for
the benefit of both humans and tools (like kapidox).