224 Commits

Author SHA1 Message Date
Albert Astals Cid
e45b65e814 rgb: Fix crash in fuzzed image
An image without color channels makes no sense
2019-01-28 21:48:26 +01:00
Albert Astals Cid
7e86e62e86 pcx: Fix crash on fuzzed image 2019-01-28 21:40:42 +01:00
Albert Astals Cid
0e21713267 rgb: fix crash in fuzzed file 2019-01-28 21:10:18 +01:00
Albert Astals Cid
188271a5d0 xcf: initialize layer mode
https://gitlab.gnome.org/GNOME/gimp/raw/master/devel-docs/xcf.txt
  When reading old XCF files that lack this property, assume mode==0.
2019-01-28 21:05:29 +01:00
Albert Astals Cid
311296dd19 xcf: initialize layer opacity
https://gitlab.gnome.org/GNOME/gimp/raw/master/devel-docs/xcf.txt
  When reading old XCF files that lack this property, full opacity
  should be assumed.
2019-01-28 20:31:18 +01:00
Albert Astals Cid
d6ae11a691 xcf: set buffer to 0 if read less data that expected
Fixes MemorySanitizer: use-of-uninitialized-value on fuzzed file
2019-01-28 20:09:21 +01:00
Albert Astals Cid
3923c9b855 bzero -> memset
Seems bzero is less portable
2019-01-28 19:18:01 +01:00
Fabian Vogt
51d710adda Fix various OOB reads and writes in kimg_tga and kimg_xcf
Summary:
I had a look at some image loading code in kimageformats and found memory
corruption bugs (there might be more):

- oobwrite4b.xcf: OOB write in kimg_xcf:

By overflowing the "size = 3 * ncolors + 4;" calculation, it's possible to make
size == 3 or size == 0, which then allows 1 or 4 bytes to be overwritten:
https://cgit.kde.org/kimageformats.git/tree/src/imageformats/xcf.cpp?id=3f2552f21b1cdef063c2a93cc95d42a8cf907fcf#n484
The values aren't arbitrary, so AFAICT DoS only.
Fix is to move the sanity check for size below the assignment.

- oobread.tga: OOB read in kimg_tga:

By overflowing the "size = tga.width * tga.height * pixel_size" calculation,
it's possible to cause OOB reads later on as the image data array is too small:
https://cgit.kde.org/kimageformats.git/tree/src/imageformats/tga.cpp?id=3f2552f21b1cdef063c2a93cc95d42a8cf907fcf#n192
Fix is to use a 64bit integer instead.

- oobwrite4b.tga/oobwrite507.tga: OOB write in kimg_tga

If RLE is enabled, any size checks are skipped, so it's possible to write
either 128 repetitions of an arbitrary four byte value (oobwrite4b.tga)
or or 507 arbitrary bytes (oobwrite507.tga) out of bounds.
https://cgit.kde.org/kimageformats.git/tree/src/imageformats/tga.cpp?id=3f2552f21b1cdef063c2a93cc95d42a8cf907fcf#n209
Fix is to check for "num" being negative before reading into the buffer.

Also, bail out early if there is no more data available (reading a 65kx65k px image from 14B data takes ages otherwise)

Test Plan:
Stopped crashing and valgrind don't complain anymore.

TGA preview still works for valid files.

Reviewers: aacid

Reviewed By: aacid

Subscribers: lbeltrame, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D18574
2019-01-28 14:21:27 +01:00
Albert Astals Cid
52a5959c08 pic: resize header id back if didn't read 4 bytes as expected 2019-01-28 01:56:12 +01:00
Albert Astals Cid
309cddbe83 xcf: bzero buffer if read less data than expected 2019-01-28 01:30:17 +01:00
Albert Astals Cid
47f46d4463 xcf: Only call setDotsPerMeterX/Y if PROP_RESOLUTION is found
https://gitlab.gnome.org/GNOME/gimp/blob/master/devel-docs/xcf.txt says
it's not really that important to be there
2019-01-27 13:14:30 +01:00
Albert Astals Cid
bff6142b44 xcf: initialize num_colors 2019-01-27 13:07:37 +01:00
Albert Astals Cid
09abfd8084 xcf: Initialize layer visible property
https://gitlab.gnome.org/GNOME/gimp/blob/master/devel-docs/xcf.txt says
	When reading old XCF files that lack this property, assume that layers are visible
2019-01-27 13:03:51 +01:00
Albert Astals Cid
964624ba40 xcf: Don't cast int to enum that can't hold that int value 2019-01-27 12:50:19 +01:00
Albert Astals Cid
3dee6f7c47 xcf: Do not overflow int on the setDotsPerMeterX/Y call 2019-01-27 12:29:07 +01:00
Albert Astals Cid
b8cb5e322c delete copy constructor and assignment operator of some internal classes
they are unused, but if anyone would use them things would go wrong, so protect us from it
2019-01-13 22:30:55 +01:00
Yuri Chornoivan
8ac949d459 Fix minor EBN issues 2018-10-22 19:58:24 +03:00
David Faure
f485719012 kimg_rgb: optimize away QRegExp and QString::fromLocal8Bit.
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
2018-10-03 00:51:29 +02:00
Friedrich W. H. Kossebau
1db1b94657 [EPS] qWarning -> qCWarning 2018-09-17 11:56:58 +02:00
Friedrich W. H. Kossebau
98c65a438d [EPS] Fix crash at app shutdown (being tried to persist clipboard image)
Summary:
Deny any capabilities when there is no QApp instance.

BUG: 397040

Test Plan:
Untested, as I do not experience the bug on my system and had no time to
invest into trying to.

Reviewers: zccrs, dfaure, pino

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15405
2018-09-17 11:54:18 +02:00
Laurent Montel
67a84f459d Use override 2018-06-12 07:01:11 +02:00
Alexander Volkov
813a7bdddb Remove duplicated mime types from json files
Qt expects a bijection between keys and mime types.
2018-05-25 14:32:11 +03:00
Laurent Montel
a4d1f4db1d Use override 2018-05-23 08:06:50 +02:00
Christoph Feck
19f33239e7 [XCF/GIMP loader] Raise maximimum allowed image size to 32767x32767 on 64 bit platforms
The GIMP image loader had a limit to 16K x 16K pixels, because this would
already exhaust the 2 GByte address space limit of 32 bit systems.

Remove this limit on 64 bit systems to allow the full 32K x 32K size.

BUG: 391970

Differential Revision: https://phabricator.kde.org/D12557
2018-05-02 02:10:26 +02:00
Laurent Montel
698ba297d3 We depend against 5.8.0 now 2018-03-27 08:01:04 +02:00
Laurent Montel
e5b226e804 Remove not necessary QtCore and co 2018-03-11 13:49:26 +01:00
Friedrich W. H. Kossebau
7aa5333a3f kcoreaddons_add_plugin: remove effectless OBJECT_DEPENDS on json file
The JSON file argument is passed to Q_PLUGIN_METADATA, which is a no-code
macro at the C++ level and only used to note information used by moc
for the generated moc file.

So when the content of the JSON file has changed, this will not change
anything in the preprocessed source file itself. It only has an effect on
the content of the moc file generated based on it, which is either included
and thus already triggers a dependecy or generated by automoc and compiled
separately into the target with the needed dependencies.

It is automoc which needs to properly trigger a recreation of the moc
file when checking the sources (and at least in 3.9 & 10 does),
and this is nothing that can be influenced by dependency rules.
2018-02-23 19:09:18 +01:00
David Faure
04e2ee01cb Set LIBRARY_OUTPUT_DIRECTORY so the autotests can run without the plugins installed
Do this properly by defining a function (inspired by kcoreaddons_add_plugin)
2018-01-05 11:19:18 +01:00
Martin Koller
7f2c44add4 Use brace-initializer instead of nullptr in returning 0-QFlags
Differential Revision: https://phabricator.kde.org/D9182
2017-12-05 19:34:30 +01:00
Montel Laurent
b040cf0f96 Use Q_FALLTHROUGH 2017-06-02 07:52:48 +02:00
Kevin Funk
740fe5df0e Use nullptr everywhere
Differential Revision: https://phabricator.kde.org/D3987
2017-01-16 09:44:17 +01:00
Allen Winter
09b1ac5a16 imageformats/kra.h - overrides for KraPlugin capabilities() and create() 2016-10-16 11:50:18 -04:00
Heiko Becker
5fdcdff6e3 Drop obsolete version check
Frameworks already require Qt 5.5.0.

REVIEW: 128989
2016-09-23 00:51:41 +02:00
Pino Toscano
172c494cff remove extra ';' 2016-06-09 10:57:48 +02:00
Boudewijn Rempt
6934d54417 Add kra and ora imageio plugins (read-only)
kra is the native format for Krita and ora the interchange format
for krita, gimp and mypaint (it's also mypaint's native format).
Both formats are simply zip containers with an embedded png.

REVIEW:126675
2016-01-31 15:01:32 +01:00
Wolfgang Bauer
5d7ef7c38e fix loading of RLE compressed PSD files
decodeRLEData() expects a quint16 as length, but the PSD loader calls it
 with a quint32.
We do need quint32 for PSD, otherwise it would overflow for images
bigger than 256x256 pixels (it's the pixel count there, i.e. width x
 height).

BUG: 354413
FIXED-IN: 5.19.0
REVIEW: 126684
2016-01-10 13:24:35 +01:00
Kai Uwe Broulik
f2adcb81d1 Recognize image/vnd.adobe.photoshop instead of image/x-psd
REVIEW: 125790
2015-11-07 13:27:42 +01:00
Luca Beltrame
814c7a2b30 Partially revert d7f457a to prevent crash on application exit
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
2015-11-04 23:51:53 +01:00
Montel Laurent
d7f457a124 Use QStringLiteral 2015-11-02 21:57:43 +01:00
Samuel Gaist
4a54da668a eps: fix includes related to Qt Caterogized Logging
Testing Done:
Build on OS X 10.8

Reviewed at https://git.reviewboard.kde.org/r/125025/
2015-09-03 18:15:54 +02:00
Heiko Becker
e5fce91de6 Remove DDS and JPEG-2000 plugins
They were already disabled when building with Qt >= 5.3 in commit
3d45b270ea8341d1516d5863cc49884c2744f2f2 because Qt has better plugins
for those image formats. Now that we depend on Qt 5.3 we can remove
them.

REVIEW: 124636
2015-08-06 00:57:14 +02:00
Christoph Cullmann
c7a04b0ed6 less verbose categorized logging, move to ecm module later 2015-08-02 13:01:54 +02:00
Sergio Martins
52c7839741 Initialize variable to silence warning [-Wsometimes-uninitialized]
It's uninitialized if the else {} is hit.
2015-05-02 23:32:24 +01:00
Albert Astals Cid
55af097749 Don't warn the user/developer about something he can't fix
image formats are loaded via qimage/qimagereader and friends, the user/developer does not choose which ones will be used so giving him a warning about sequential devices not being supported is not going to help anyone, only spam their shell/logs.

REVIEW: 123156
Acked by David Edmundson
2015-03-29 23:21:17 +02:00
Dan Vrátil
b7910e169e Fix build with Qt 5.5 (missing QDataStream include) 2015-02-27 19:03:29 +01:00
Alex Merry
873746d04b Build fix for OS/X.
CCMAIL: mk-lists@email.de
2015-02-21 11:41:58 +00:00
Alex Merry
47e8043d45 Make PSD image reader endianess-agnostic.
By using the same strategy as the SoftImage PIC handler (and sharing
some code with it), we should avoid reading the image data incorrectly
on big-endian architectures.

REVIEW: 122650
BUG: 337918
2015-02-20 23:03:10 +00:00
Kevin Funk
ac2b63046f Use Q_DECL_OVERRIDE where possible
REVIEW: 122542
2015-02-13 13:31:27 +01:00
Hrvoje Senjan
4cdcf3a98c Add missing QDataStream include
Fixes build with Qt 5.5
2015-01-17 03:40:59 +01:00
Alex Merry
88518c5862 Update installation variables. 2015-01-10 17:46:30 +00:00