File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
modules/core/include/opencv2/core Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -1592,7 +1592,10 @@ Size_<_Tp>& Size_<_Tp>::operator = (const Size_<_Tp>& sz)
1592
1592
template <typename _Tp> inline
1593
1593
_Tp Size_<_Tp>::area() const
1594
1594
{
1595
- return width * height;
1595
+ const _Tp result = width * height;
1596
+ CV_DbgAssert (!std::numeric_limits<_Tp>::is_integer
1597
+ || width == 0 || result / width == height); // make sure the result fits in the return value
1598
+ return result;
1596
1599
}
1597
1600
1598
1601
template <typename _Tp> static inline
@@ -1731,7 +1734,10 @@ Size_<_Tp> Rect_<_Tp>::size() const
1731
1734
template <typename _Tp> inline
1732
1735
_Tp Rect_<_Tp>::area() const
1733
1736
{
1734
- return width * height;
1737
+ const _Tp result = width * height;
1738
+ CV_DbgAssert (!std::numeric_limits<_Tp>::is_integer
1739
+ || width == 0 || result / width == height); // make sure the result fits in the return value
1740
+ return result;
1735
1741
}
1736
1742
1737
1743
template <typename _Tp> template <typename _Tp2> inline
You can’t perform that action at this time.
0 commit comments