Fixes Coverity CID 709288: Division or modulo by zero (DIVIDE_BY_ZERO)
Division by expression "STEPS" which may be zero has undefined behavior
139    avg=avg/STEPS;
...
150    return delta / STEPS;
---
 thumbnailer/westleypreview.cpp |    1 +
 1 file changed, 1 insertion(+)

diff --git a/thumbnailer/westleypreview.cpp b/thumbnailer/westleypreview.cpp
index 8512b60..9113278 100644
--- a/thumbnailer/westleypreview.cpp
+++ b/thumbnailer/westleypreview.cpp
@@ -123,6 +123,7 @@ uint MltPreview::imageVariance(QImage image)
     uint delta = 0;
     uint avg = 0;
     uint bytes = image.numBytes();
+    if (bytes == 0) return 0;
     uint STEPS = bytes / 2;
     QVarLengthArray<uchar> pivot(STEPS);
     kDebug(DBG_AREA) << "Using " << STEPS << " steps\n";
-- 
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