From: Alexander Alekhin Date: Sun, 4 Oct 2020 07:11:41 +0000 (+0000) Subject: core(test): regression test for 18473 X-Git-Tag: submit/tizen/20210224.033012~2^2~9^2~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f30aafc3cc77e87898dbbb9013f9de7ca32a73b4;p=platform%2Fupstream%2Fopencv.git core(test): regression test for 18473 --- diff --git a/modules/core/test/test_mat.cpp b/modules/core/test/test_mat.cpp index 43e0078..0bc3961 100644 --- a/modules/core/test/test_mat.cpp +++ b/modules/core/test/test_mat.cpp @@ -2185,4 +2185,32 @@ TEST(Mat, empty_iterator_16855) EXPECT_TRUE(m.begin() == m.end()); } + +TEST(Mat, regression_18473) +{ + std::vector sizes(3); + sizes[0] = 20; + sizes[1] = 50; + sizes[2] = 100; +#if 1 // with the fix + std::vector steps(2); + steps[0] = 50*100*2; + steps[1] = 100*2; +#else // without the fix + std::vector steps(3); + steps[0] = 50*100*2; + steps[1] = 100*2; + steps[2] = 2; +#endif + std::vector data(20*50*100, 0); // 1Mb + data[data.size() - 1] = 5; + + // param steps Array of ndims-1 steps + Mat m(sizes, CV_16SC1, (void*)data.data(), (const size_t*)steps.data()); + + ASSERT_FALSE(m.empty()); + EXPECT_EQ((int)5, (int)m.at(19, 49, 99)); +} + + }} // namespace