Skip to content

Commit 83e6813

Browse files
committed
imgproc: add missing check into cvtColorTwoPlane()
1 parent bf8136e commit 83e6813

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

modules/imgproc/src/color_yuv.dispatch.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,8 @@ void cvtColorTwoPlaneYUV2BGRpair( InputArray _ysrc, InputArray _uvsrc, OutputArr
406406

407407
Mat ysrc = _ysrc.getMat(), uvsrc = _uvsrc.getMat();
408408

409+
CV_CheckEQ(ysrc.step, uvsrc.step, "");
410+
409411
_dst.create( ysz, CV_MAKETYPE(depth, dcn));
410412
Mat dst = _dst.getMat();
411413

modules/imgproc/test/test_color.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3072,4 +3072,21 @@ TEST(ImgProc_RGB2YUV, regression_13668)
30723072
EXPECT_EQ(res, ref);
30733073
}
30743074

3075+
TEST(ImgProc_cvtColorTwoPlane, missing_check_17036) // test can be removed if required feature is implemented
3076+
{
3077+
std::vector<uchar> y_data(700 * 480);
3078+
std::vector<uchar> uv_data(640 * 240);
3079+
3080+
Mat y_plane_padding(480, 640, CV_8UC1, y_data.data(), 700); // with stride
3081+
Mat uv_plane(240, 320, CV_8UC2, uv_data.data());
3082+
3083+
Mat result;
3084+
3085+
EXPECT_THROW(
3086+
cvtColorTwoPlane(y_plane_padding, uv_plane, result, COLOR_YUV2RGB_NV21);
3087+
, cv::Exception
3088+
);
3089+
}
3090+
3091+
30753092
}} // namespace

0 commit comments

Comments
 (0)