From 57d85d500f14cf07ad4a797d68d221a59a29cb0c Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 26 Sep 2016 20:06:11 +0000 Subject: main/newsbeuter: fix segfault ref #6220 --- main/newsbeuter/APKBUILD | 12 +++-- main/newsbeuter/fix-segfault.patch | 92 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 main/newsbeuter/fix-segfault.patch (limited to 'main/newsbeuter') diff --git a/main/newsbeuter/APKBUILD b/main/newsbeuter/APKBUILD index 05d9fb0f8d..4a7ff510dc 100644 --- a/main/newsbeuter/APKBUILD +++ b/main/newsbeuter/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa pkgname=newsbeuter pkgver=2.9 -pkgrel=2 +pkgrel=3 pkgdesc="Configurable text-based feed reader" url="http://newsbeuter.org/" arch="all" @@ -15,6 +15,7 @@ subpackages="$pkgname-doc $pkgname-lang" source="http://newsbeuter.org/downloads/newsbeuter-$pkgver.tar.gz 0001-Remove-iconv-translit-references.patch newsbeuter-2.9-ncurses6.patch + fix-segfault.patch " _builddir="$srcdir"/newsbeuter-$pkgver @@ -44,10 +45,13 @@ package() { md5sums="9cf332dc7e591023147bda7add430835 newsbeuter-2.9.tar.gz 2d158695303d3605425d5b30465408b8 0001-Remove-iconv-translit-references.patch -6450d3794d543f9edae934f86a3ce7ef newsbeuter-2.9-ncurses6.patch" +6450d3794d543f9edae934f86a3ce7ef newsbeuter-2.9-ncurses6.patch +bbf607a93fa88d75a137e60b2b4d8eba fix-segfault.patch" sha256sums="74a8bf019b09c3b270ba95adc29f2bbe48ea1f55cc0634276b21fcce1f043dc8 newsbeuter-2.9.tar.gz 122613fd512a17f938d98ceb5aa3a1a9ddcff7dc4e7ac640e490637d2f645ba9 0001-Remove-iconv-translit-references.patch -5ae54c463f44d91725da3be655d2b107d598ade6da86ab4a99b10b039b8dba27 newsbeuter-2.9-ncurses6.patch" +5ae54c463f44d91725da3be655d2b107d598ade6da86ab4a99b10b039b8dba27 newsbeuter-2.9-ncurses6.patch +6359708ee01f5e1b773a6ed79b7369b30aad5397b85fd252c2fa7d0c2616ea86 fix-segfault.patch" sha512sums="b173008c8c8d3729f8ccef3ce62645a05c1803fb842d5c0afdf9ffd4ed3726030f9c359c20bc817402a6a0ea12af742d0ae7faf9b92d52c11f420f62b430b0aa newsbeuter-2.9.tar.gz 1cfbe93cd8ca5785b1c26ccfdf1ed467700046c8ca564f33752b0f04f91d37765f83bf82ad593eae41532edf79a8f6992283255f9a2aa8293d14728b175c9dd7 0001-Remove-iconv-translit-references.patch -08f7125fd8f2b33fa5e36cbd947ec90bcd8b08be2df7961aced20ce031788b3970c1adeb027b1527ba06f18ddbc38518f2c22da6b5fdbc4b1cd5b0edda22ba0b newsbeuter-2.9-ncurses6.patch" +08f7125fd8f2b33fa5e36cbd947ec90bcd8b08be2df7961aced20ce031788b3970c1adeb027b1527ba06f18ddbc38518f2c22da6b5fdbc4b1cd5b0edda22ba0b newsbeuter-2.9-ncurses6.patch +da986beb12b0ba473fea55c067abcdcdae6c073bf4d66bc8913696a4da99c4072edaf3910769d8e4bcef3a0411875eb23fbc840e0e7572aa0e16e922cc3d2947 fix-segfault.patch" diff --git a/main/newsbeuter/fix-segfault.patch b/main/newsbeuter/fix-segfault.patch new file mode 100644 index 0000000000..0792d89397 --- /dev/null +++ b/main/newsbeuter/fix-segfault.patch @@ -0,0 +1,92 @@ +From e11b656bda59ca31b4f9ab4c5a14696813b0f6f4 Mon Sep 17 00:00:00 2001 +From: Tilman Keskinoz +Date: Thu, 12 Mar 2015 11:03:50 +0100 +Subject: [PATCH 1/3] Detach thread, to avoid thread being destructed when it + is going out of scope + +--- + src/pb_controller.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/pb_controller.cpp b/src/pb_controller.cpp +index 09b5e89..da8ffcb 100644 +--- a/src/pb_controller.cpp ++++ b/src/pb_controller.cpp +@@ -287,6 +287,7 @@ void pb_controller::start_downloads() { + if (it->status() == DL_QUEUED) { + std::thread t {poddlthread(&(*it), cfg)}; + --dl2start; ++ t.detach(); + } + } + } + +From f79e5527ba5f54677540637f5b8d287215cfa051 Mon Sep 17 00:00:00 2001 +From: Tilman Keskinoz +Date: Thu, 12 Mar 2015 11:04:49 +0100 +Subject: [PATCH 2/3] Fix segfault + +I think somewhere the poddlthread is copied and the memory messed up. +Make it a shared_ptr to fix segfault. + +Why is this a pointer anyway? +--- + include/poddlthread.h | 3 ++- + src/poddlthread.cpp | 1 - + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/poddlthread.h b/include/poddlthread.h +index a10b9e7..cf0f1da 100644 +--- a/include/poddlthread.h ++++ b/include/poddlthread.h +@@ -7,6 +7,7 @@ + + #include + #include ++#include + + #include + +@@ -24,7 +25,7 @@ class poddlthread { + private: + void mkdir_p(const char * file); + download * dl; +- std::ofstream *f; ++ std::shared_ptr f; + timeval tv1; + timeval tv2; + size_t bytecount; +diff --git a/src/poddlthread.cpp b/src/poddlthread.cpp +index 583481e..3a1b390 100644 +--- a/src/poddlthread.cpp ++++ b/src/poddlthread.cpp +@@ -22,7 +22,6 @@ poddlthread::poddlthread(download * dl_, newsbeuter::configcontainer * c) : dl(d + } + + poddlthread::~poddlthread() { +- delete f; + } + + void poddlthread::operator()() { + +From 49dbf84d9500860c48c1d3137cf0d7ab89588726 Mon Sep 17 00:00:00 2001 +From: Tilman Keskinoz +Date: Thu, 12 Mar 2015 11:30:24 +0100 +Subject: [PATCH 3/3] Another threa.detach() missing + +--- + src/pb_view.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/pb_view.cpp b/src/pb_view.cpp +index fb61c72..f3cb478 100644 +--- a/src/pb_view.cpp ++++ b/src/pb_view.cpp +@@ -111,6 +111,7 @@ void pb_view::run(bool auto_download) { + if (idx != -1) { + if (ctrl->downloads()[idx].status() != DL_DOWNLOADING) { + std::thread t {poddlthread(&ctrl->downloads()[idx], ctrl->get_cfgcont())}; ++ t.detach(); + } + } + } -- cgit v1.2.3