summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-08-20 04:11:32 +0200
committerRobin Gareus <robin@gareus.org>2019-08-20 04:11:32 +0200
commitbb27d10fd4c0c64b1ef1778ba647b641efade523 (patch)
tree17dbcb986f41123931ff50cb8ee965d8709e2233 /libs
parenta1b0991d26504629f49f33f943702feb05bb7672 (diff)
Fix potential ambiguous state-restore
Don't allow uninitialized argument values in case of corrupt XML state.
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/chan_count.cc8
-rw-r--r--libs/ardour/chan_mapping.cc11
2 files changed, 10 insertions, 9 deletions
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);
+ }
}
}
}