Commit 51983682 authored by LEFEBVREJP email's avatar LEFEBVREJP email
Browse files

Merge branch 'marchingsquares_overflow' into 'master'

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

See merge request !46
parents d7cf44b8 45e89f6b
Pipeline #14432 passed with stages
in 8 minutes and 9 seconds
...@@ -31,10 +31,10 @@ void MarchingSquares<data_type>::clear_connected_component(int row, int col, ...@@ -31,10 +31,10 @@ void MarchingSquares<data_type>::clear_connected_component(int row, int col,
// search neighbors // search neighbors
for (int direction = 0; direction < 4; ++direction) for (int direction = 0; direction < 4; ++direction)
{ {
size_t nc = col + dx[direction]; int nc = col + dx[direction];
size_t nr = row + dy[direction]; int nr = row + dy[direction];
if (nc < 0 || nc == mColumns) continue; // out of bounds if (nc < 0 || nc >= mColumns) continue; // out of bounds
if (nr < 0 || nr == mRows) continue; // out of bounds if (nr < 0 || nr >= mRows) continue; // out of bounds
size_t nc_i = mColumns * nr + nc; size_t nc_i = mColumns * nr + nc;
if (mBit[nc_i] == label) 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