From bb27d10fd4c0c64b1ef1778ba647b641efade523 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 20 Aug 2019 04:11:32 +0200 Subject: Fix potential ambiguous state-restore Don't allow uninitialized argument values in case of corrupt XML state. --- libs/ardour/chan_count.cc | 8 ++++---- libs/ardour/chan_mapping.cc | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'libs') diff --git a/libs/ardour/chan_count.cc b/libs/ardour/chan_count.cc index e14949f360..6324f8c0fb 100644 --- a/libs/ardour/chan_count.cc +++ b/libs/ardour/chan_count.cc @@ -38,11 +38,11 @@ ChanCount::ChanCount(const XMLNode& node) XMLNodeConstIterator iter = node.children().begin(); for ( ; iter != node.children().end(); ++iter) { if ((*iter)->name() == X_(state_node_name)) { - DataType type(DataType::NIL); + DataType type (DataType::NIL); uint32_t count; - (*iter)->get_property("type", type); - (*iter)->get_property("count", count); - set(type, count); + if ((*iter)->get_property ("type", type) && (*iter)->get_property ("count", count)) { + set(type, count); + } } } } diff --git a/libs/ardour/chan_mapping.cc b/libs/ardour/chan_mapping.cc index c4e933ad05..3ccc92d42a 100644 --- a/libs/ardour/chan_mapping.cc +++ b/libs/ardour/chan_mapping.cc @@ -55,13 +55,14 @@ ChanMapping::ChanMapping (const XMLNode& node) XMLNodeConstIterator iter = node.children().begin(); for ( ; iter != node.children().end(); ++iter) { if ((*iter)->name() == X_(state_node_name)) { - DataType type(DataType::NIL); + DataType type (DataType::NIL); uint32_t from; uint32_t to; - (*iter)->get_property("type", type); - (*iter)->get_property("from", from); - (*iter)->get_property("to", to); - set(type, from, to); + if ( (*iter)->get_property ("type", type) + && (*iter)->get_property ("from", from) + && (*iter)->get_property ("to", to)) { + set(type, from, to); + } } } } -- cgit v1.2.3