EXPECT_TRUE(m.begin<uchar>() == m.end<uchar>());
}
+
+TEST(Mat, regression_18473)
+{
+ std::vector<int> sizes(3);
+ sizes[0] = 20;
+ sizes[1] = 50;
+ sizes[2] = 100;
+#if 1 // with the fix
+ std::vector<size_t> steps(2);
+ steps[0] = 50*100*2;
+ steps[1] = 100*2;
+#else // without the fix
+ std::vector<size_t> steps(3);
+ steps[0] = 50*100*2;
+ steps[1] = 100*2;
+ steps[2] = 2;
+#endif
+ std::vector<short> 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<short>(19, 49, 99));
+}
+
+
}} // namespace