# HG changeset patch # User Chris Cannam # Date 1409739618 -3600 # Node ID 7aa9088e9bcd1daf46a9c5c299d4dd8624e84030 # Parent a0573186435e1bc36f43a92cb5c6f190a4a2e3dc Fix various slightly dodgy derefs and the like (from coverity scan) diff -r a0573186435e -r 7aa9088e9bcd plugin/DSSIPluginFactory.cpp --- a/plugin/DSSIPluginFactory.cpp Wed Sep 03 11:10:22 2014 +0100 +++ b/plugin/DSSIPluginFactory.cpp Wed Sep 03 11:20:18 2014 +0100 @@ -346,8 +346,8 @@ category = m_taxonomy[identifier]; } - if (category == "" && ladspaDescriptor->Name != 0) { - std::string name = ladspaDescriptor->Name; + if (category == "") { + std::string name = rtd->name; if (name.length() > 4 && name.substr(name.length() - 4) == " VST") { if (descriptor->run_synth || descriptor->run_multiple_synths) { diff -r a0573186435e -r 7aa9088e9bcd plugin/DSSIPluginInstance.cpp --- a/plugin/DSSIPluginInstance.cpp Wed Sep 03 11:10:22 2014 +0100 +++ b/plugin/DSSIPluginInstance.cpp Wed Sep 03 11:20:18 2014 +0100 @@ -64,6 +64,7 @@ RealTimePluginInstance(factory, identifier), m_client(clientId), m_position(position), + m_instanceHandle(0), m_descriptor(descriptor), m_programCacheValid(false), m_eventBuffer(EVENT_BUFFER_SIZE), @@ -146,6 +147,7 @@ { ParameterList list; LADSPAPluginFactory *f = dynamic_cast(m_factory); + if (!f) return list; for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { @@ -988,7 +990,7 @@ if (count == 0) count = m_blockSize; bool needLock = false; - if (m_descriptor->select_program) needLock = true; + if (m_descriptor && m_descriptor->select_program) needLock = true; if (needLock) { if (!m_processLock.tryLock()) { diff -r a0573186435e -r 7aa9088e9bcd plugin/FeatureExtractionPluginFactory.cpp --- a/plugin/FeatureExtractionPluginFactory.cpp Wed Sep 03 11:10:22 2014 +0100 +++ b/plugin/FeatureExtractionPluginFactory.cpp Wed Sep 03 11:20:18 2014 +0100 @@ -48,6 +48,8 @@ Vamp::Plugin *p = m_plugin; delete m_plugin; m_plugin = 0; + // acceptable use after free here, as pluginDeleted uses p only as + // pointer key and does not deref it if (m_factory) m_factory->pluginDeleted(p); } diff -r a0573186435e -r 7aa9088e9bcd plugin/LADSPAPluginFactory.cpp --- a/plugin/LADSPAPluginFactory.cpp Wed Sep 03 11:10:22 2014 +0100 +++ b/plugin/LADSPAPluginFactory.cpp Wed Sep 03 11:20:18 2014 +0100 @@ -730,8 +730,8 @@ QString category = m_taxonomy[identifier]; - if (category == "" && descriptor->Name != 0) { - std::string name = descriptor->Name; + if (category == "") { + std::string name = rtd->name; if (name.length() > 4 && name.substr(name.length() - 4) == " VST") { category = "VST effects"; diff -r a0573186435e -r 7aa9088e9bcd plugin/LADSPAPluginInstance.cpp --- a/plugin/LADSPAPluginInstance.cpp Wed Sep 03 11:10:22 2014 +0100 +++ b/plugin/LADSPAPluginInstance.cpp Wed Sep 03 11:20:18 2014 +0100 @@ -123,6 +123,7 @@ { ParameterList list; LADSPAPluginFactory *f = dynamic_cast(m_factory); + if (!f) return list; for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) {