Commit 45e89f6b authored by LEFEBVREJP email's avatar LEFEBVREJP email
Browse files

Fixing overflow of clear_connected_components where starting point is zero and direction is -1.

parent d7cf44b8
Pipeline #14243 passed with stages
in 13 minutes and 13 seconds
......@@ -31,10 +31,10 @@ void MarchingSquares<data_type>::clear_connected_component(int row, int col,
// search neighbors
for (int direction = 0; direction < 4; ++direction)
{
size_t nc = col + dx[direction];
size_t nr = row + dy[direction];
if (nc < 0 || nc == mColumns) continue; // out of bounds
if (nr < 0 || nr == mRows) continue; // out of bounds
int nc = col + dx[direction];
int nr = row + dy[direction];
if (nc < 0 || nc >= mColumns) continue; // out of bounds
if (nr < 0 || nr >= mRows) continue; // out of bounds
size_t nc_i = mColumns * nr + nc;
if (mBit[nc_i] == label)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment