From 2b6aa50b815c987e2a7c3fc6a69f71562b2109d0 Mon Sep 17 00:00:00 2001 From: Kuang Fangjun Date: Sat, 14 Jul 2018 16:05:29 +0800 Subject: [PATCH] avoid negative index. --- modules/core/src/check.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/src/check.cpp b/modules/core/src/check.cpp index ebaa294385..fca982656e 100644 --- a/modules/core/src/check.cpp +++ b/modules/core/src/check.cpp @@ -44,7 +44,7 @@ static const char* getTestOpMath(unsigned testOp) const char* depthToString_(int depth) { static const char* depthNames[] = { "CV_8U", "CV_8S", "CV_16U", "CV_16S", "CV_32S", "CV_32F", "CV_64F", "CV_USRTYPE1" }; - return depth <= CV_USRTYPE1 ? depthNames[depth] : NULL; + return (depth <= CV_USRTYPE1 && depth >= 0) ? depthNames[depth] : NULL; } const cv::String typeToString_(int type)