CID 709285: Division or modulo by zero (DIVIDE_BY_ZERO)
Division by expression "STEPS" which may be zero has undefined behavior
250 avg=avg/STEPS;
---
src/kthumb.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/kthumb.cpp b/src/kthumb.cpp
index c5e1691..428d437 100644
--- a/src/kthumb.cpp
+++ b/src/kthumb.cpp
@@ -247,7 +247,8 @@ uint KThumb::imageVariance(QImage image )
avg+=pivot[i];
#endif
}
- avg=avg/STEPS;
+ if (STEPS)
+ avg=avg/STEPS;
// Second Step: calculate delta (average?)
for (uint i=0; i<STEPS; i++)
{
@@ -258,7 +259,10 @@ uint KThumb::imageVariance(QImage image )
#endif
delta+=curdelta;
}
- return delta/STEPS;
+ if (STEPS)
+ return delta/STEPS;
+ else
+ return 0;
}
/*
--
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