From e1b57057bf1eed3cb50be1786d592f255f24b4b5 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Tue, 23 Jul 2024 16:22:55 +0200 Subject: [PATCH] Avoid future integer overflow in _OutputArray::create This fix is useless in 4.x and fixes harmless overflows in 5.x This belongs to 4.x as it is closer to the intended meaning. --- modules/core/src/matrix_wrap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/src/matrix_wrap.cpp b/modules/core/src/matrix_wrap.cpp index 238fc642fd..b72fdbe784 100644 --- a/modules/core/src/matrix_wrap.cpp +++ b/modules/core/src/matrix_wrap.cpp @@ -1294,7 +1294,7 @@ void _OutputArray::create(int d, const int* sizes, int mtype, int i, if(fixedType()) { - if(CV_MAT_CN(mtype) == m.channels() && ((1 << CV_MAT_TYPE(flags)) & fixedDepthMask) != 0 ) + if(CV_MAT_CN(mtype) == m.channels() && ((1 << CV_MAT_DEPTH(flags)) & fixedDepthMask) != 0 ) mtype = m.type(); else CV_CheckTypeEQ(m.type(), CV_MAT_TYPE(mtype), "Can't reallocate Mat with locked type (probably due to misused 'const' modifier)");