From bcd147c5e18c532f4ca72d1f0a5eb2b613fc52a8 Mon Sep 17 00:00:00 2001 From: Martijn van Buul Date: Sat, 9 Sep 2017 23:35:30 +0200 Subject: [PATCH] qucs: Fix simulator crash Avoid undefined behaviour while traversing and modifying a std::list. Patch has been reported to Qucs upstream. Fixes https://github.com/voidlinux/void-packages/issues/7604 --- .../patches/qucsator-fix-list-traversion.patch | 17 +++++++++++++++++ srcpkgs/qucs/template | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/qucs/patches/qucsator-fix-list-traversion.patch diff --git a/srcpkgs/qucs/patches/qucsator-fix-list-traversion.patch b/srcpkgs/qucs/patches/qucsator-fix-list-traversion.patch new file mode 100644 index 00000000000..c22a608adc0 --- /dev/null +++ b/srcpkgs/qucs/patches/qucsator-fix-list-traversion.patch @@ -0,0 +1,17 @@ +--- qucs-core/src/net.cpp.org 2017-09-13 20:47:24.863069583 +0200 ++++ qucs-core/src/net.cpp 2017-09-10 00:16:48.863636748 +0200 +@@ -350,7 +350,13 @@ + void net::sortChildAnalyses (analysis * parent) { + ptrlist * alist = parent->getAnalysis (); + if (alist != nullptr) { +- for (auto *a: *alist) { ++ ++ for (auto it = alist->begin(); it != alist->end(); /* empty */) { ++ // Copy the value of the element (a pointer), and advance the ++ // iterator prior to manipulating the list. ++ analysis *a = *it; ++ ++it; ++ + if (a->getType () == ANALYSIS_DC + || containsAnalysis (a, ANALYSIS_DC)) { + parent->delAnalysis (a); diff --git a/srcpkgs/qucs/template b/srcpkgs/qucs/template index 9dc81586724..4c18a3258c3 100644 --- a/srcpkgs/qucs/template +++ b/srcpkgs/qucs/template @@ -1,7 +1,7 @@ # Template file for 'qucs' pkgname=qucs version=0.0.19 -revision=1 +revision=2 build_style=gnu-configure configure_args="--disable-doc" hostmakedepends="ADMS-qucs gperf qt-devel"