Skip to content

Commit

Permalink
r.in.xyz: fix integer overflow (manual backport of OSGeo#2847)
Browse files Browse the repository at this point in the history
Address integer overflow in call to Rast_set_null_value()
by instead looping over rows and set rows to NULL.

Solution by:
Co-authored-by: Markus Metz <markus.metz.giswork@gmail.com>
  • Loading branch information
nilason committed Feb 22, 2023
1 parent edcb882 commit aca4979
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions raster/r.in.xyz/support.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ int blank_array(void *array, int nrows, int ncols, RASTER_MAP_TYPE map_type,
case -1:
/* fill with NULL */
/* alloc for col+1, do we come up (nrows) short? no. */
Rast_set_null_value(array, nrows * ncols, map_type);
break;
for (row = 0; row < nrows; row++) {
Rast_set_null_value(ptr, ncols, map_type);
ptr = G_incr_void_ptr(ptr, ncols * Rast_cell_size(map_type));
}
break;

default:
return -1;
Expand Down

0 comments on commit aca4979

Please sign in to comment.