Fixes Coverity CID 709286: Division or modulo by zero (DIVIDE_BY_ZERO)
Assigning: "maxVal" = "this->max()".
On this path, function call "this->max()" has return value of 0
78    int64_t maxVal = max();
...
Division by expression "maxVal" which may be zero has undefined behavior
86        val = m_correlationVector[x]/double(maxVal)*img.height();
---
 src/lib/audio/audioCorrelationInfo.cpp |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/lib/audio/audioCorrelationInfo.cpp 
b/src/lib/audio/audioCorrelationInfo.cpp
index ea9e90c..db438bd 100644
--- a/src/lib/audio/audioCorrelationInfo.cpp
+++ b/src/lib/audio/audioCorrelationInfo.cpp
@@ -80,6 +80,9 @@ QImage AudioCorrelationInfo::toImage(int height) const
     QImage img(width, height, QImage::Format_ARGB32);
     img.fill(qRgb(255,255,255));
 
+    if (maxVal == 0)
+       return img;
+
     int val;
 
     for (int x = 0; x < width; x++) {
-- 
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