template<typename _Tp> inline
_Tp Size_<_Tp>::area() const
{
- return width * height;
+ const _Tp result = width * height;
+ CV_DbgAssert(!std::numeric_limits<_Tp>::is_integer
+ || width == 0 || result / width == height); // make sure the result fits in the return value
+ return result;
}
template<typename _Tp> static inline
template<typename _Tp> inline
_Tp Rect_<_Tp>::area() const
{
- return width * height;
+ const _Tp result = width * height;
+ CV_DbgAssert(!std::numeric_limits<_Tp>::is_integer
+ || width == 0 || result / width == height); // make sure the result fits in the return value
+ return result;
}
template<typename _Tp> template<typename _Tp2> inline