Fixes Coverity CID 709287: Division or modulo by zero (DIVIDE_BY_ZERO)
Call to "this->loadEnvelope()" set "this->m_envelopeMax" to 0.
182        loadEnvelope();
...
Division by expression "this->m_envelopeMax" which may be zero has undefined 
behavior
189        fy = m_envelope[x]/double(m_envelopeMax) * img.height();
---
 src/lib/audio/audioEnvelope.cpp |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lib/audio/audioEnvelope.cpp b/src/lib/audio/audioEnvelope.cpp
index 00bda00..d476959 100644
--- a/src/lib/audio/audioEnvelope.cpp
+++ b/src/lib/audio/audioEnvelope.cpp
@@ -184,6 +184,10 @@ QImage AudioEnvelope::drawEnvelope()
 
     QImage img(m_envelopeSize, 400, QImage::Format_ARGB32);
     img.fill(qRgb(255,255,255));
+
+    if (m_envelopeMax == 0)
+        return img;
+
     double fy;
     for (int x = 0; x < img.width(); x++) {
         fy = m_envelope[x]/double(m_envelopeMax) * img.height();
-- 
1.7.10.4


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Kdenlive-devel mailing list
Kdenlive-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kdenlive-devel

Reply via email to