Fixes Coverity CID 709284: Division or modulo by zero (DIVIDE_BY_ZERO)
Division by expression "byteCount >> 7" which may be zero has undefined behavior
87 const float scaling = (float)partH/(byteCount >> 7);
---
src/colorcorrection/histogramgenerator.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/colorcorrection/histogramgenerator.cpp
b/src/colorcorrection/histogramgenerator.cpp
index 456aad6..2681c50 100644
--- a/src/colorcorrection/histogramgenerator.cpp
+++ b/src/colorcorrection/histogramgenerator.cpp
@@ -84,7 +84,10 @@ QImage HistogramGenerator::calculateHistogram(const QSize
¶deSize, const QIm
const int d = 20; // Distance for text
const int partH = (wh-nParts*d)/nParts;
- const float scaling = (float)partH/(byteCount >> 7);
+ float scaling = 0;
+ int div = byteCount >> 7;
+ if ( div > 0 )
+ scaling = (float)partH/(byteCount >> 7);
const int dist = 40;
int wy = 0; // Drawing position
--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/kdenlive-devel