diff --git a/modules/core/src/norm.dispatch.cpp b/modules/core/src/norm.dispatch.cpp index 6999e55cdf..a20eaf0824 100644 --- a/modules/core/src/norm.dispatch.cpp +++ b/modules/core/src/norm.dispatch.cpp @@ -316,7 +316,7 @@ double norm( InputArray _src, int normType, InputArray _mask ) } NormFunc func = getNormFunc(normType >> 1, depth == CV_16F ? CV_32F : depth); - CV_Assert( func != 0 ); + CV_Assert( (normType >> 1) >= 3 || func != 0 ); if( src.isContinuous() && mask.empty() ) { diff --git a/modules/core/src/norm.simd.hpp b/modules/core/src/norm.simd.hpp index 68bd21258e..1e94fff719 100644 --- a/modules/core/src/norm.simd.hpp +++ b/modules/core/src/norm.simd.hpp @@ -1324,6 +1324,8 @@ NormFunc getNormFunc(int normType, int depth) } }; + if (normType >= 3 || normType < 0) return nullptr; + return normTab[normType][depth]; }