diff --git a/modules/core/src/norm.dispatch.cpp b/modules/core/src/norm.dispatch.cpp index 9f02df47e7..6999e55cdf 100644 --- a/modules/core/src/norm.dispatch.cpp +++ b/modules/core/src/norm.dispatch.cpp @@ -571,7 +571,7 @@ double norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask ((normType == NORM_HAMMING || normType == NORM_HAMMING2) && src1.type() == CV_8U) ); NormDiffFunc func = getNormDiffFunc(normType >> 1, depth == CV_16F ? CV_32F : depth); - CV_Assert( func != 0 ); + CV_Assert( (normType >> 1) >= 3 || func != 0 ); if( src1.isContinuous() && src2.isContinuous() && mask.empty() ) { diff --git a/modules/core/src/norm.simd.hpp b/modules/core/src/norm.simd.hpp index 05227dde90..68bd21258e 100644 --- a/modules/core/src/norm.simd.hpp +++ b/modules/core/src/norm.simd.hpp @@ -1350,6 +1350,7 @@ NormDiffFunc getNormDiffFunc(int normType, int depth) (NormDiffFunc)normDiffL2_64f, 0 } }; + if (normType >= 3 || normType < 0) return nullptr; return normDiffTab[normType][depth]; }