diff options
author | Kwanghoon Son <k.son@samsung.com> | 2022-07-14 01:38:05 -0400 |
---|---|---|
committer | Inki Dae <inki.dae@samsung.com> | 2022-07-20 14:16:57 +0900 |
commit | ae2cf9ed5ab42dc81206f36fdc390b1ff11ea127 (patch) | |
tree | 38be66ddbeabd2b2d73501dadcbc7bc0a74bb990 /mv_common | |
parent | 26dcb23156aa94cb79968a7c9ac01678ff2c49fc (diff) | |
download | mediavision-ae2cf9ed5ab42dc81206f36fdc390b1ff11ea127.tar.gz mediavision-ae2cf9ed5ab42dc81206f36fdc390b1ff11ea127.tar.bz2 mediavision-ae2cf9ed5ab42dc81206f36fdc390b1ff11ea127.zip |
mv_common: Add buffer size check
[Issue type] : Bug fix
Change-Id: Iee755ff4d2871a5c1a809b3ec4eed0a73555008c
Reported-by: TSEVEN-2231
Signed-off-by: Kwanghoon Son <k.son@samsung.com>
Diffstat (limited to 'mv_common')
-rw-r--r-- | mv_common/src/CommonUtils.cpp | 6 |
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(); |