mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
handle huge matrices correctly (#11505)
* make sure that the matrix with more than INT_MAX elements is marked as non-continuous, and thus all the pixel-wise functions process it correctly (i.e. row-by-row, not as a single row, where integer overflow may occur when computing the total number of elements)
This commit is contained in:
@@ -201,10 +201,13 @@ void cv::cuda::HostMem::create(int rows_, int cols_, int type_)
|
||||
|
||||
if (rows_ > 0 && cols_ > 0)
|
||||
{
|
||||
flags = Mat::MAGIC_VAL + Mat::CONTINUOUS_FLAG + type_;
|
||||
flags = Mat::MAGIC_VAL + type_;
|
||||
rows = rows_;
|
||||
cols = cols_;
|
||||
step = elemSize() * cols;
|
||||
int sz[] = { rows, cols };
|
||||
size_t steps[] = { step, CV_ELEM_SIZE(type_) };
|
||||
flags = updateContinuityFlag(flags, 2, sz, steps);
|
||||
|
||||
if (alloc_type == SHARED)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user