public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: kde-frameworks/kio/, kde-frameworks/kio/files/
Date: Sun,  4 Apr 2021 13:23:10 +0000 (UTC)	[thread overview]
Message-ID: <1617542380.8b66280500df8b8a4da00c3da550eb8dc989bd33.asturm@gentoo> (raw)

commit:     8b66280500df8b8a4da00c3da550eb8dc989bd33
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  4 12:23:39 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Apr  4 13:19:40 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b662805

kde-frameworks/kio: Fix crash in ThumbnailProtocol

Upstream commit a68cb73c4e071ed24b18a95e11fbbbc8d59840b4

KDE-bug: https://bugs.kde.org/show_bug.cgi?id=430862
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 ...kio-5.80.1-fix-crash-in-ThumbnailProtocol.patch | 104 +++++++++++++++++++++
 kde-frameworks/kio/kio-5.80.1-r2.ebuild            |   1 +
 2 files changed, 105 insertions(+)

diff --git a/kde-frameworks/kio/files/kio-5.80.1-fix-crash-in-ThumbnailProtocol.patch b/kde-frameworks/kio/files/kio-5.80.1-fix-crash-in-ThumbnailProtocol.patch
new file mode 100644
index 00000000000..059c9f82424
--- /dev/null
+++ b/kde-frameworks/kio/files/kio-5.80.1-fix-crash-in-ThumbnailProtocol.patch
@@ -0,0 +1,104 @@
+From a68cb73c4e071ed24b18a95e11fbbbc8d59840b4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?M=C3=A9ven=20Car?= <meven29@gmail.com>
+Date: Sun, 21 Mar 2021 05:22:57 +0100
+Subject: [PATCH] PreviewJob: Initialize cachesSize with 0, only pass size > 0
+ to shmget, improve createThumbnail
+
+BUG: 430862
+---
+ src/widgets/previewjob.cpp | 48 +++++++++++++++++++++++---------------
+ 1 file changed, 29 insertions(+), 19 deletions(-)
+
+diff --git a/src/widgets/previewjob.cpp b/src/widgets/previewjob.cpp
+index 988da16b0..9b6e661e8 100644
+--- a/src/widgets/previewjob.cpp
++++ b/src/widgets/previewjob.cpp
+@@ -70,7 +70,7 @@ public:
+         : initialItems(items)
+         , width(size.width())
+         , height(size.height())
+-        , cacheSize(-1)
++        , cacheSize(0)
+         , bScale(true)
+         , bSave(true)
+         , ignoreMaximumSize(false)
+@@ -114,8 +114,8 @@ public:
+     // Size of thumbnail
+     int width;
+     int height;
+-    // Unscaled size of thumbnail (128 or 256 if cache is enabled)
+-    int cacheSize;
++    // Unscaled size of thumbnail (128, 256 or 512 if cache is enabled)
++    ushort cacheSize;
+     // Whether the thumbnail should be scaled
+     bool bScale;
+     // Whether we should save the thumbnail
+@@ -712,39 +712,49 @@ void PreviewJobPrivate::createThumbnail(const QString &pixPath)
+     });
+ 
+     bool save = bSave && currentItem.plugin->property(QStringLiteral("CacheThumbnail")).toBool() && !sequenceIndex;
++    int thumb_width = width;
++    int thumb_height = height;
++    int thumb_iconSize = iconSize;
++    if (save) {
++        thumb_width = thumb_height = cacheSize;
++        thumb_iconSize = 64;
++    }
++
+     job->addMetaData(QStringLiteral("mimeType"), currentItem.item.mimetype());
+-    job->addMetaData(QStringLiteral("width"), QString().setNum(save ? cacheSize : width));
+-    job->addMetaData(QStringLiteral("height"), QString().setNum(save ? cacheSize : height));
+-    job->addMetaData(QStringLiteral("iconSize"), QString().setNum(save ? 64 : iconSize));
+-    job->addMetaData(QStringLiteral("iconAlpha"), QString().setNum(iconAlpha));
++    job->addMetaData(QStringLiteral("width"), QString::number(thumb_width));
++    job->addMetaData(QStringLiteral("height"), QString::number(thumb_height));
++    job->addMetaData(QStringLiteral("iconSize"), QString::number(thumb_iconSize));
++    job->addMetaData(QStringLiteral("iconAlpha"), QString::number(iconAlpha));
+     job->addMetaData(QStringLiteral("plugin"), currentItem.plugin->library());
+     job->addMetaData(QStringLiteral("enabledPlugins"), enabledPlugins.join(QLatin1Char(',')));
+     job->addMetaData(QStringLiteral("devicePixelRatio"), QString::number(devicePixelRatio));
+     if (sequenceIndex) {
+-        job->addMetaData(QStringLiteral("sequence-index"), QString().setNum(sequenceIndex));
++        job->addMetaData(QStringLiteral("sequence-index"), QString::number(sequenceIndex));
+     }
+ 
+ #if WITH_SHM
+     if (shmid == -1) {
+         if (shmaddr) {
++            // clean previous shared memory segment
+             shmdt((char *)shmaddr);
+             shmctl(shmid, IPC_RMID, nullptr);
++            shmaddr = nullptr;
+         }
+-        auto size = std::max(cacheSize * cacheSize, width * height);
+-        shmid = shmget(IPC_PRIVATE, size * 4 * devicePixelRatio * devicePixelRatio, IPC_CREAT | 0600);
+-        if (shmid != -1) {
+-            shmaddr = (uchar *)(shmat(shmid, nullptr, SHM_RDONLY));
+-            if (shmaddr == (uchar *)-1) {
+-                shmctl(shmid, IPC_RMID, nullptr);
+-                shmaddr = nullptr;
+-                shmid = -1;
++        auto size = thumb_width * thumb_height;
++        if (size > 0) {
++            shmid = shmget(IPC_PRIVATE, size * 4 * devicePixelRatio * devicePixelRatio, IPC_CREAT | 0600);
++            if (shmid != -1) {
++                shmaddr = (uchar *)(shmat(shmid, nullptr, SHM_RDONLY));
++                if (shmaddr == (uchar *)-1) {
++                    shmctl(shmid, IPC_RMID, nullptr);
++                    shmaddr = nullptr;
++                    shmid = -1;
++                }
+             }
+-        } else {
+-            shmaddr = nullptr;
+         }
+     }
+     if (shmid != -1) {
+-        job->addMetaData(QStringLiteral("shmid"), QString().setNum(shmid));
++        job->addMetaData(QStringLiteral("shmid"), QString::number(shmid));
+     }
+ #endif
+ }
+-- 
+GitLab
+

diff --git a/kde-frameworks/kio/kio-5.80.1-r2.ebuild b/kde-frameworks/kio/kio-5.80.1-r2.ebuild
index 59bdb0d13ea..ee0dc3c8892 100644
--- a/kde-frameworks/kio/kio-5.80.1-r2.ebuild
+++ b/kde-frameworks/kio/kio-5.80.1-r2.ebuild
@@ -75,6 +75,7 @@ PATCHES=(
 	"${FILESDIR}"/${P}-MimeTypeFinderJob-file.so.patch # KDE-Bug 434455
 	"${FILESDIR}"/${P}-gcc11-include-order.patch # bug 766480
 	"${FILESDIR}"/${P}-fix-create-files-on-ftp.patch # KDE-Bug 429541
+	"${FILESDIR}"/${P}-fix-crash-in-ThumbnailProtocol.patch # KDE-Bug 430862
 )
 
 src_configure() {


             reply	other threads:[~2021-04-04 13:23 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-04 13:23 Andreas Sturmlechner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-11-15 13:46 [gentoo-commits] repo/gentoo:master commit in: kde-frameworks/kio/, kde-frameworks/kio/files/ Andreas Sturmlechner
2024-08-10  7:57 Andreas Sturmlechner
2024-07-16 16:32 Andreas Sturmlechner
2024-03-24 21:03 Andreas Sturmlechner
2024-03-19  9:10 Andreas Sturmlechner
2023-06-22 21:16 Andreas Sturmlechner
2023-03-26  9:52 Andreas Sturmlechner
2023-03-23 16:47 Andreas Sturmlechner
2023-03-23  8:11 Andreas Sturmlechner
2023-01-25 10:22 Andreas Sturmlechner
2022-11-27 11:20 Andreas Sturmlechner
2022-08-08 14:40 Andreas Sturmlechner
2022-07-26 12:08 Andreas Sturmlechner
2022-07-19 13:29 Andreas Sturmlechner
2022-06-29 19:53 Andreas Sturmlechner
2021-12-08 15:08 Andreas Sturmlechner
2021-11-18 10:38 Andreas Sturmlechner
2021-08-15 18:57 Andreas Sturmlechner
2021-08-14 17:09 Andreas Sturmlechner
2021-07-16 15:21 Andreas Sturmlechner
2021-07-14 12:41 Andreas Sturmlechner
2021-05-30 15:51 Andreas Sturmlechner
2021-05-15 10:49 Andreas Sturmlechner
2021-04-11 14:23 Andreas Sturmlechner
2021-03-25 23:13 Andreas Sturmlechner
2021-02-13 20:49 Andreas Sturmlechner
2021-02-12 21:48 Andreas Sturmlechner
2021-01-24 13:02 Andreas Sturmlechner
2021-01-11 12:28 Andreas Sturmlechner
2020-12-23 21:32 Andreas Sturmlechner
2020-11-16 23:41 Andreas Sturmlechner
2020-09-29 12:49 Andreas Sturmlechner
2020-05-16 22:38 Andreas Sturmlechner
2019-01-16 12:50 Andreas Sturmlechner
2018-07-21 16:51 Andreas Sturmlechner
2017-12-03 12:34 Andreas Sturmlechner
2017-09-30 20:34 Andreas Sturmlechner
2017-05-17 22:08 Andreas Sturmlechner
2017-02-28 21:02 Johannes Huber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1617542380.8b66280500df8b8a4da00c3da550eb8dc989bd33.asturm@gentoo \
    --to=asturm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox