Mercurial > hg > svcore
changeset 973:7aa9088e9bcd
Fix various slightly dodgy derefs and the like (from coverity scan)
author | Chris Cannam |
---|---|
date | Wed, 03 Sep 2014 11:20:18 +0100 |
parents | a0573186435e |
children | 65494d0d9ded |
files | plugin/DSSIPluginFactory.cpp plugin/DSSIPluginInstance.cpp plugin/FeatureExtractionPluginFactory.cpp plugin/LADSPAPluginFactory.cpp plugin/LADSPAPluginInstance.cpp |
diffstat | 5 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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) {
--- 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<LADSPAPluginFactory *>(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()) {
--- 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); }
--- 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";
--- 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<LADSPAPluginFactory *>(m_factory); + if (!f) return list; for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) {