Opened 9 years ago

Last modified 5 years ago

#2754 new enhancement

Handle corrupt data in r.gwflow and gpde library

Reported by: wenzeslaus Owned by: grass-dev@…
Priority: trivial Milestone: 7.6.2
Component: Raster Version: svn-trunk
Keywords: r.gwflow, gpde, libgpde, dirichlet Cc:
CPU: All Platform: All

Description

Moving r.gwflow-related discussion from #2750 to a separate ticket.

In #2750 sprice suggested a simple improvement for r.gwflow and gpde library:

If you do a diff with n_les_assemble.c you'll see that I [attachment/ticket/2750/lz4_zstd4.tgz added] a few if statements to ensure that the indexing stays within row/col bounds. I was getting segfaults with corrupt data before I fixed the other bugs. I figure it should be able to handle any data without segfaulting, even if corrupt.

This is a trivial change but I'm not sure if this is necessary. Let me throw out some questions. How you can get a corrupt data unless changing raster library? If we want this to handle corrupt data here, where else we want to do that? What is the appropriate else branch, nothing or fatal error?

This is the change:

 /*set the rows to zero */
+if (count < les->rows)
     for (i = 0; i < les->cols; i++)
         les->A[count][i] = 0.0;
 /*set the cols to zero */
+if (count < les->cols)
     for (i = 0; i < les->rows; i++)
         les->A[i][count] = 0.0;
 /*entry on the diagonal */
+if (count < les->rows && count < les->cols)
     les->A[count][count] = 1.0;

The change is in N_les_integrate_dirichlet_2d() function which is used only in r.gwflow.

Change History (9)

comment:1 by neteler, 8 years ago

Milestone: 7.1.07.2.0

Milestone renamed

comment:2 by neteler, 7 years ago

Milestone: 7.2.07.2.1

Ticket retargeted after milestone closed

comment:3 by martinl, 7 years ago

Milestone: 7.2.17.2.2

comment:4 by martinl, 7 years ago

Milestone: 7.2.27.4.0

All enhancement tickets should be assigned to 7.4 milestone.

comment:5 by neteler, 6 years ago

Milestone: 7.4.07.4.1

Ticket retargeted after milestone closed

comment:6 by neteler, 6 years ago

Milestone: 7.4.17.4.2

comment:7 by martinl, 6 years ago

Milestone: 7.4.27.6.0

All enhancement tickets should be assigned to 7.6 milestone.

comment:8 by martinl, 5 years ago

Milestone: 7.6.07.6.1

Ticket retargeted after milestone closed

comment:9 by martinl, 5 years ago

Milestone: 7.6.17.6.2

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.