Skip to content

Commit

Permalink
#2521 Checks the boundary.
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard Soh committed Apr 26, 2023
1 parent 0a38a44 commit b2de76c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/tools/other/mode_time_domain/mtd_file_int.cc
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ void MtdIntFile::fatten()
int x, y, n;
const int nxy = Nx*Ny;
int * u = new int [nxy];
int * a = 0;
int * a = nullptr;

a = u;

Expand Down Expand Up @@ -899,7 +899,9 @@ for (y = 0; y<(Ny - 2); ++y) {

for (x=0; x<(Nx - 2); ++x) {

if ( *a ) {
if (n >= (nxy-1)) break; // For SonarQube findinds

if (n >=0 && *a ) {

Data[n + 1] = 1; // (x + 1, y)
Data[n + Nx] = 1; // (x, y + 1)
Expand Down Expand Up @@ -1719,11 +1721,14 @@ s.set_to_zeroes();

int * in = Data;
int * out = s.Data;
int out_size = s.nxyt();

v = 0;

for (j=0; j<n3; ++j) {

if (j >= out_size) break; // For SonarQube findinds

if ( yesno[*in] ) { *out = 1; ++v; }

++in;
Expand Down

0 comments on commit b2de76c

Please sign in to comment.