diff --git a/modules/core/src/convert_c.cpp b/modules/core/src/convert_c.cpp index 96beffccc6..ae93a73ebb 100644 --- a/modules/core/src/convert_c.cpp +++ b/modules/core/src/convert_c.cpp @@ -83,7 +83,9 @@ cvMixChannels( const CvArr** src, int src_count, CvArr** dst, int dst_count, const int* from_to, int pair_count ) { - cv::AutoBuffer buf(src_count + dst_count); + CV_Assert(src_count >= 0 && dst_count >= 0); + size_t buf_size = static_cast(src_count) + static_cast(dst_count); + cv::AutoBuffer buf(buf_size); int i; for( i = 0; i < src_count; i++ )