Skip to content

Commit

Permalink
r.in.pdal: fix integer overflow (OSGeo#2844)
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 authored Feb 21, 2023
1 parent b06c460 commit 75cb8f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion raster/r.in.pdal/point_binning.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ 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);
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:
Expand Down

0 comments on commit 75cb8f6

Please sign in to comment.