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
This commit is contained in:
Martijn van Buul 2017-09-09 23:35:30 +02:00 committed by Michael Gehring
parent 4accc03105
commit bcd147c5e1
2 changed files with 18 additions and 1 deletions

View File

@ -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<analysis> * 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);

View File

@ -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"