From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B77A01382C5 for ; Sun, 4 Apr 2021 13:23:19 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D9945E08F4; Sun, 4 Apr 2021 13:23:17 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id AD307E08F4 for ; Sun, 4 Apr 2021 13:23:17 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1091D34069F for ; Sun, 4 Apr 2021 13:23:14 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id BC6CC646 for ; Sun, 4 Apr 2021 13:23:10 +0000 (UTC) From: "Andreas Sturmlechner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andreas Sturmlechner" Message-ID: <1617542380.8b66280500df8b8a4da00c3da550eb8dc989bd33.asturm@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: kde-frameworks/kio/, kde-frameworks/kio/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: kde-frameworks/kio/files/kio-5.80.1-fix-crash-in-ThumbnailProtocol.patch kde-frameworks/kio/kio-5.80.1-r2.ebuild X-VCS-Directories: kde-frameworks/kio/ kde-frameworks/kio/files/ X-VCS-Committer: asturm X-VCS-Committer-Name: Andreas Sturmlechner X-VCS-Revision: 8b66280500df8b8a4da00c3da550eb8dc989bd33 X-VCS-Branch: master Date: Sun, 4 Apr 2021 13:23:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 286fa3b5-6dc0-4ee3-a0e8-e044126cdb19 X-Archives-Hash: 9437ff349bd7ca37b652d8ccb4049f02 commit: 8b66280500df8b8a4da00c3da550eb8dc989bd33 Author: Andreas Sturmlechner gentoo org> AuthorDate: Sun Apr 4 12:23:39 2021 +0000 Commit: Andreas Sturmlechner gentoo 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 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?= +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() {