Bug#859023: unblock: karchive/5.28.0-2
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
Dear release team,
Checking some of the KDE frameworks bugs and upstream fixes I stumbled upon a
couple of changes in karchive that I think that it would be good to include
for stretch. The changes consist on 3 new upstream patches to fix 2 problems:
+ Fix the seek implementation in KCompressionDevice (the only user that I've
found is libkdeedu's libkeduvocdocument4).
Patches: Fix-KCompressionDevice-to-work-with-Qt-5.7.patch
Fix-my-fix-for-KCompressionDevice-seek.patch
+ A minor leak fix
Patch: Fix-Potential-leak-of-memory-pointed-to-by-limitedDev.patch
I'm attaching the debdiff between the 5.28.0-1 and 5.28.0-2 versions.
This patches are included in the 5.28.0-2 version currently in unstable and it
has already built in all the release archs.
Please unblock package karchive
Happy hacking,
unblock karchive/5.28.0-2
-- System Information:
Debian Release: 9.0
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'testing'), (500, 'stable'), (50, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf
Kernel: Linux 4.9.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)
diff -Nru karchive-5.28.0/debian/changelog karchive-5.28.0/debian/changelog
--- karchive-5.28.0/debian/changelog 2016-11-18 16:00:41.000000000 +0100
+++ karchive-5.28.0/debian/changelog 2017-03-29 15:09:44.000000000 +0200
@@ -1,3 +1,13 @@
+karchive (5.28.0-2) unstable; urgency=medium
+
+ * Add upstream patches for KCompressionDevice::seek:
+ + Fix-KCompressionDevice-to-work-with-Qt-5.7.patch
+ + Fix-my-fix-for-KCompressionDevice-seek.patch
+ * Backport upstream patch:
+ + Fix-Potential-leak-of-memory-pointed-to-by-limitedDev.patch
+
+ -- Maximiliano Curia <maxy@debian.org> Wed, 29 Mar 2017 15:09:44 +0200
+
karchive (5.28.0-1) unstable; urgency=medium
[ Automatic packaging ]
diff -Nru karchive-5.28.0/debian/patches/Fix-KCompressionDevice-to-work-with-Qt-5.7.patch karchive-5.28.0/debian/patches/Fix-KCompressionDevice-to-work-with-Qt-5.7.patch
--- karchive-5.28.0/debian/patches/Fix-KCompressionDevice-to-work-with-Qt-5.7.patch 1970-01-01 01:00:00.000000000 +0100
+++ karchive-5.28.0/debian/patches/Fix-KCompressionDevice-to-work-with-Qt-5.7.patch 2017-03-29 15:09:44.000000000 +0200
@@ -0,0 +1,78 @@
+From: Albert Astals Cid <aacid@kde.org>
+Date: Sat, 4 Feb 2017 17:02:34 +0100
+Subject: Fix KCompressionDevice to work with Qt >= 5.7
+
+Don't use QIODevice:pos to track our pos, doesn't do what we want it to do.
+Call QIODevice::seek at the beginning as documentation says has to be done.
+
+Differential Revision: 4422
+---
+ src/kcompressiondevice.cpp | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/src/kcompressiondevice.cpp b/src/kcompressiondevice.cpp
+index de22bf8..04466a6 100644
+--- a/src/kcompressiondevice.cpp
++++ b/src/kcompressiondevice.cpp
+@@ -48,6 +48,7 @@ public:
+ , bOpenedUnderlyingDevice(false)
+ , bIgnoreData(false)
+ , type(KCompressionDevice::None)
++ , deviceReadPos(0)
+ {
+ }
+ bool bNeedHeader;
+@@ -59,6 +60,7 @@ public:
+ KFilterBase::Result result;
+ KFilterBase *filter;
+ KCompressionDevice::CompressionType type;
++ qint64 deviceReadPos;
+ };
+
+ KFilterBase *KCompressionDevice::filterForCompressionType(KCompressionDevice::CompressionType type)
+@@ -174,8 +176,10 @@ void KCompressionDevice::close()
+
+ bool KCompressionDevice::seek(qint64 pos)
+ {
+- qint64 ioIndex = this->pos(); // current position
+- if (ioIndex == pos) {
++ if (!QIODevice::seek(pos))
++ return false;
++
++ if (d->deviceReadPos == pos) {
+ return true;
+ }
+
+@@ -189,13 +193,13 @@ bool KCompressionDevice::seek(qint64 pos)
+ d->result = KFilterBase::Ok;
+ d->filter->setInBuffer(0L, 0);
+ d->filter->reset();
+- QIODevice::seek(pos);
++ d->deviceReadPos = 0;
+ return d->filter->device()->reset();
+ }
+
+ qint64 bytesToRead;
+- if (ioIndex < pos) { // we can start from here
+- bytesToRead = pos - ioIndex;
++ if (d->deviceReadPos < pos) { // we can start from here
++ bytesToRead = pos - d->deviceReadPos;
+ } else {
+ // we have to start from 0 ! Ugly and slow, but better than the previous
+ // solution (KTarGz was allocating everything into memory)
+@@ -210,7 +214,6 @@ bool KCompressionDevice::seek(qint64 pos)
+ d->bIgnoreData = true;
+ const bool result = (read(dummy.data(), bytesToRead) == bytesToRead);
+ d->bIgnoreData = false;
+- QIODevice::seek(pos);
+ return result;
+ }
+
+@@ -303,6 +306,7 @@ qint64 KCompressionDevice::readData(char *data, qint64 maxlen)
+ filter->setOutBuffer(data, availOut);
+ }
+
++ d->deviceReadPos += dataReceived;
+ return dataReceived;
+ }
+
diff -Nru karchive-5.28.0/debian/patches/Fix-my-fix-for-KCompressionDevice-seek.patch karchive-5.28.0/debian/patches/Fix-my-fix-for-KCompressionDevice-seek.patch
--- karchive-5.28.0/debian/patches/Fix-my-fix-for-KCompressionDevice-seek.patch 1970-01-01 01:00:00.000000000 +0100
+++ karchive-5.28.0/debian/patches/Fix-my-fix-for-KCompressionDevice-seek.patch 2017-03-29 15:09:44.000000000 +0200
@@ -0,0 +1,50 @@
+From: Albert Astals Cid <aacid@kde.org>
+Date: Sun, 5 Feb 2017 01:49:42 +0100
+Subject: Fix my fix for KCompressionDevice::seek
+
+Differential Revision: https://phabricator.kde.org/D4437
+---
+ src/kcompressiondevice.cpp | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/src/kcompressiondevice.cpp b/src/kcompressiondevice.cpp
+index 04466a6..2b70ae0 100644
+--- a/src/kcompressiondevice.cpp
++++ b/src/kcompressiondevice.cpp
+@@ -176,11 +176,8 @@ void KCompressionDevice::close()
+
+ bool KCompressionDevice::seek(qint64 pos)
+ {
+- if (!QIODevice::seek(pos))
+- return false;
+-
+ if (d->deviceReadPos == pos) {
+- return true;
++ return QIODevice::seek(pos);
+ }
+
+ //qDebug() << "seek(" << pos << ") called, current pos=" << ioIndex;
+@@ -188,6 +185,9 @@ bool KCompressionDevice::seek(qint64 pos)
+ Q_ASSERT(d->filter->mode() == QIODevice::ReadOnly);
+
+ if (pos == 0) {
++ if (!QIODevice::seek(pos))
++ return false;
++
+ // We can forget about the cached data
+ d->bNeedHeader = !d->bSkipHeaders;
+ d->result = KFilterBase::Ok;
+@@ -200,6 +200,13 @@ bool KCompressionDevice::seek(qint64 pos)
+ qint64 bytesToRead;
+ if (d->deviceReadPos < pos) { // we can start from here
+ bytesToRead = pos - d->deviceReadPos;
++ // Since we're going to do a read() below
++ // we need to reset the internal QIODevice pos to the real position we are
++ // so that after read() we are indeed pointing to the pos seek
++ // asked us to be in
++ if (!QIODevice::seek(d->deviceReadPos)) {
++ return false;
++ }
+ } else {
+ // we have to start from 0 ! Ugly and slow, but better than the previous
+ // solution (KTarGz was allocating everything into memory)
diff -Nru karchive-5.28.0/debian/patches/Fix-Potential-leak-of-memory-pointed-to-by-limitedDev.patch karchive-5.28.0/debian/patches/Fix-Potential-leak-of-memory-pointed-to-by-limitedDev.patch
--- karchive-5.28.0/debian/patches/Fix-Potential-leak-of-memory-pointed-to-by-limitedDev.patch 1970-01-01 01:00:00.000000000 +0100
+++ karchive-5.28.0/debian/patches/Fix-Potential-leak-of-memory-pointed-to-by-limitedDev.patch 2017-03-29 15:09:44.000000000 +0200
@@ -0,0 +1,20 @@
+From: Leslie Zhai <xiangzhai83@gmail.com>
+Date: Wed, 1 Mar 2017 16:42:30 +0800
+Subject: Fix Potential leak of memory pointed to by 'limitedDev'.
+
+REVIEW: 129976
+---
+ src/kzip.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/kzip.cpp b/src/kzip.cpp
+index 94d4276..d7216c1 100644
+--- a/src/kzip.cpp
++++ b/src/kzip.cpp
+@@ -1423,5 +1423,6 @@ QIODevice *KZipFileEntry::createDevice() const
+ qCritical() << "This zip file contains files compressed with method"
+ << encoding() << ", this method is currently not supported by KZip,"
+ << "please use a command-line tool to handle this file.";
++ delete limitedDev;
+ return 0;
+ }
diff -Nru karchive-5.28.0/debian/patches/series karchive-5.28.0/debian/patches/series
--- karchive-5.28.0/debian/patches/series 1970-01-01 01:00:00.000000000 +0100
+++ karchive-5.28.0/debian/patches/series 2017-03-29 15:09:44.000000000 +0200
@@ -0,0 +1,3 @@
+Fix-KCompressionDevice-to-work-with-Qt-5.7.patch
+Fix-my-fix-for-KCompressionDevice-seek.patch
+Fix-Potential-leak-of-memory-pointed-to-by-limitedDev.patch
Reply to: