summaryrefslogtreecommitdiff
path: root/kde-frameworks/kimageformats
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-07-25 22:29:02 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-07-25 22:29:02 +0100
commit240b57012ace855bbfd9934b07642416ceeeb5b8 (patch)
treef73ef3c4e5df8a1c5ca8d47177cb034006e0ac09 /kde-frameworks/kimageformats
parent5c636a121a9064a4373d06b60d49a6f5d67c0e2f (diff)
gentoo auto-resync : 25:07:2023 - 22:29:01
Diffstat (limited to 'kde-frameworks/kimageformats')
-rw-r--r--kde-frameworks/kimageformats/Manifest3
-rw-r--r--kde-frameworks/kimageformats/files/kimageformats-5.108.0-psd-fix-UB-type-punning.patch89
-rw-r--r--kde-frameworks/kimageformats/kimageformats-5.108.0-r1.ebuild (renamed from kde-frameworks/kimageformats/kimageformats-5.108.0.ebuild)4
3 files changed, 94 insertions, 2 deletions
diff --git a/kde-frameworks/kimageformats/Manifest b/kde-frameworks/kimageformats/Manifest
index 67380216cd34..d1bb3ce9915f 100644
--- a/kde-frameworks/kimageformats/Manifest
+++ b/kde-frameworks/kimageformats/Manifest
@@ -1,5 +1,6 @@
+AUX kimageformats-5.108.0-psd-fix-UB-type-punning.patch 3538 BLAKE2B 4f48647edb100cec9529ed6613e1080351f8f5980aff986b6ee0bd77be383aea798df3c117b1a5bcf57136f26473ed15af5e33934253557b2d23e992def70345 SHA512 3dbf83c39291370deb4f59f37da43048f7188f0d7b54d98d6fd92e67d7b184d978705159e95f331ee2f8f65528d3d8221762505a43cae30428fc3dcb274f9794
DIST kimageformats-5.106.0.tar.xz 12944348 BLAKE2B 968205afd22d0ad69fa36023e6f0285215b7131924abcf3203429269dd0dd18e727b86fe9c489fd41ccf2efeeabe9ad904488d521bc4e0fe7f0bd65d15d941bf SHA512 e58e742f916784889efc201a1eb4c759d2b88c9c50825ef2cb6d4e776f502387e054f031d9ca4401285dbc928fb6347783346fcffce2851d7a22589f5d42c7b7
DIST kimageformats-5.108.0.tar.xz 12999676 BLAKE2B 97be58d634be159890cdc460e07fdc524398c7022b1b6d428baea4f6c53524783b05a9857470fae5a44fc7f3a38d852cdb331543c987b01d1328c5adc8739aa7 SHA512 df43867153cecd876fd48fd8c9cbfe78016ed25fe6e1f074f4f395e4c0bf9f62c7bfbe3d40f79fca591d0e07324c4f58de214594a23c227e07bb33cf7f2805f0
EBUILD kimageformats-5.106.0.ebuild 1136 BLAKE2B 83fdea0e000b46d3c50f855fa90231f84e9ef2495c30d6b2f36fb6818b1f0f9e187034ae597acfd7fbd70912f111deb6c4f77b00416c1cb970bb029e103bfa3c SHA512 f467cc6606c7dc1afc746b8d997d269e5eb17d476b7aef8503d349b00d303cc7f654fa2cba52c329a0cd9f3f0bb7939d4944e7dd00cf58c62898eae1184d30d1
-EBUILD kimageformats-5.108.0.ebuild 1114 BLAKE2B bc62ebe4734e0a1826a6e6435b6df4de10aa8aa3f9e5f02fa1f5645af99347ba5df8920ab823f9b9f6ccb65fbe1fcad5d6265983c91f6400a14476623f5bc445 SHA512 a0eba6ff05dec577aad0e07d129aa4cdc6c3ae87a3cf4c177673feaa1bdf7f6c5bdb80ba4912f24d65bfe21657e5894aa3096e80b32fb92a353767e29faca854
+EBUILD kimageformats-5.108.0-r1.ebuild 1182 BLAKE2B 2b975cc7a683e54c1d1467388bc5e19c6c6a49aeabe020543f79ec472fe46c2a6670a3e58f2b8df4f175f8fe7e11801b6f2cedb0278f434d1596b64f62e4f55e SHA512 435b844324188dc2de74e8a34b1d7740d5679d1126373b8b60651fca3df87464d6862e3c019c16b62dad279b557226be99d6a3c10156dd2479ae73798b005261
MISC metadata.xml 719 BLAKE2B f87d63a81cb7e008eed6141a6436eb8dbef4f47c614ad950f5cf4b73b13eb79d496bb64bf64b2b7a1ab7ef5879aa6148acc167e18976dc52f77344e72a9c3040 SHA512 fbd11e370afc821a8ef5a809d9436201f6b679c37651fbc2d7f74ab701d85d369f27740b6253800efa60332f6eeab323973f1007de07cb81b0f9f11c6b0b1fd4
diff --git a/kde-frameworks/kimageformats/files/kimageformats-5.108.0-psd-fix-UB-type-punning.patch b/kde-frameworks/kimageformats/files/kimageformats-5.108.0-psd-fix-UB-type-punning.patch
new file mode 100644
index 000000000000..68d853a5f447
--- /dev/null
+++ b/kde-frameworks/kimageformats/files/kimageformats-5.108.0-psd-fix-UB-type-punning.patch
@@ -0,0 +1,89 @@
+From c3a91c3bc62bdd913c55dd83f4e1159ed25310c5 Mon Sep 17 00:00:00 2001
+From: Mirco Miranda <mirco.miranda@systemceramics.com>
+Date: Sun, 16 Jul 2023 08:03:58 +0000
+Subject: [PATCH] psd: Fix UB type punning
+
+BUGS: 471829
+---
+ src/imageformats/psd.cpp | 33 ++++++++++++++++++++++++++-------
+ 1 file changed, 26 insertions(+), 7 deletions(-)
+
+diff --git a/src/imageformats/psd.cpp b/src/imageformats/psd.cpp
+index 7280aea..b0c76e2 100644
+--- a/src/imageformats/psd.cpp
++++ b/src/imageformats/psd.cpp
+@@ -42,6 +42,7 @@
+ #include <QColorSpace>
+
+ #include <cmath>
++#include <cstring>
+
+ typedef quint32 uint;
+ typedef quint16 ushort;
+@@ -808,6 +809,26 @@ inline quint32 xchg(quint32 v) {
+ #endif
+ }
+
++inline float xchg(float v)
++{
++#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
++# ifdef Q_CC_MSVC
++ float *pf = &v;
++ quint32 f = xchg(*reinterpret_cast<quint32*>(pf));
++ quint32 *pi = &f;
++ return *reinterpret_cast<float*>(pi);
++# else
++ quint32 t;
++ std::memcpy(&t, &v, sizeof(quint32));
++ t = xchg(t);
++ std::memcpy(&v, &t, sizeof(quint32));
++ return v;
++# endif
++#else
++ return v; // never tested
++#endif
++}
++
+ template<class T>
+ inline void planarToChunchy(uchar *target, const char *source, qint32 width, qint32 c, qint32 cn)
+ {
+@@ -818,15 +839,13 @@ inline void planarToChunchy(uchar *target, const char *source, qint32 width, qin
+ }
+ }
+
+-template<class T, T min = 0, T max = 1>
+-inline void planarToChunchyFloat(uchar *target, const char *source, qint32 width, qint32 c, qint32 cn)
++template<class T>
++inline void planarToChunchyFloatToUInt16(uchar *target, const char *source, qint32 width, qint32 c, qint32 cn)
+ {
+ auto s = reinterpret_cast<const T*>(source);
+ auto t = reinterpret_cast<quint16*>(target);
+ for (qint32 x = 0; x < width; ++x) {
+- auto tmp = xchg(s[x]);
+- auto ftmp = (*reinterpret_cast<float*>(&tmp) - double(min)) / (double(max) - double(min));
+- t[x * cn + c] = quint16(std::min(ftmp * std::numeric_limits<quint16>::max() + 0.5, double(std::numeric_limits<quint16>::max())));
++ t[x * cn + c] = quint16(std::min(xchg(s[x]) * std::numeric_limits<quint16>::max() + 0.5, double(std::numeric_limits<quint16>::max())));
+ }
+ }
+
+@@ -1140,7 +1159,7 @@ static bool LoadPSD(QDataStream &stream, const PSDHeader &header, QImage &img)
+ } else if (header.depth == 16) {
+ planarToChunchy<quint16>(scanLine, rawStride.data(), header.width, c, header.channel_count);
+ } else if (header.depth == 32) {
+- planarToChunchyFloat<quint32>(scanLine, rawStride.data(), header.width, c, header.channel_count);
++ planarToChunchyFloatToUInt16<float>(scanLine, rawStride.data(), header.width, c, header.channel_count);
+ }
+ }
+
+@@ -1204,7 +1223,7 @@ static bool LoadPSD(QDataStream &stream, const PSDHeader &header, QImage &img)
+ } else if (header.depth == 16) { // 16-bits integer images: Grayscale, RGB/RGBA
+ planarToChunchy<quint16>(scanLine, rawStride.data(), header.width, c, imgChannels);
+ } else if (header.depth == 32) { // 32-bits float images: Grayscale, RGB/RGBA (coverted to equivalent integer 16-bits)
+- planarToChunchyFloat<quint32>(scanLine, rawStride.data(), header.width, c, imgChannels);
++ planarToChunchyFloatToUInt16<float>(scanLine, rawStride.data(), header.width, c, imgChannels);
+ }
+ }
+ }
+--
+GitLab
+
diff --git a/kde-frameworks/kimageformats/kimageformats-5.108.0.ebuild b/kde-frameworks/kimageformats/kimageformats-5.108.0-r1.ebuild
index 70f355e7b66f..f9158d45b201 100644
--- a/kde-frameworks/kimageformats/kimageformats-5.108.0.ebuild
+++ b/kde-frameworks/kimageformats/kimageformats-5.108.0-r1.ebuild
@@ -11,7 +11,7 @@ inherit ecm frameworks.kde.org
DESCRIPTION="Framework providing additional format plugins for Qt's image I/O system"
LICENSE="LGPL-2+"
-KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86"
+KEYWORDS="amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv x86"
IUSE="avif eps heif jpegxl openexr raw"
RDEPEND="
@@ -30,6 +30,8 @@ DEPEND="${RDEPEND}
DOCS=( src/imageformats/AUTHORS )
+PATCHES=( "${FILESDIR}/${P}-psd-fix-UB-type-punning.patch" ) # 5.109
+
src_configure() {
local mycmakeargs=(
-DKIMAGEFORMATS_JXL=$(usex jpegxl)