summaryrefslogtreecommitdiff
path: root/mv_common
diff options
context:
space:
mode:
Diffstat (limited to 'mv_common')
-rw-r--r--mv_common/src/CommonUtils.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/mv_common/src/CommonUtils.cpp b/mv_common/src/CommonUtils.cpp
index 52e6bea5..4b217145 100644
--- a/mv_common/src/CommonUtils.cpp
+++ b/mv_common/src/CommonUtils.cpp
@@ -99,6 +99,12 @@ int convertSourceMV2GrayCV(mv_source_h mvSource, cv::Mat& cvSource)
return MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT;
}
+ if (bufferSize < width * height * channelsNumber) {
+ LOGE("bufferSize : %u is too small for image w: %u, h: %u, c: %u",
+ bufferSize, width, height, channelsNumber);
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ }
+
if (conversionType == -1) {/* Without conversion */
cvSource = cv::Mat(cv::Size(width, height),
CV_MAKETYPE(depth, channelsNumber), buffer).clone();