[GRASS-SVN] r73284 - grass/trunk/imagery/i.segment
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Sep 7 08:57:00 PDT 2018
Author: mmetz
Date: 2018-09-07 08:56:59 -0700 (Fri, 07 Sep 2018)
New Revision: 73284
Modified:
grass/trunk/imagery/i.segment/iseg.h
grass/trunk/imagery/i.segment/open_files.c
Log:
i.segment: avoid integer overflow with extremely large regions
Modified: grass/trunk/imagery/i.segment/iseg.h
===================================================================
--- grass/trunk/imagery/i.segment/iseg.h 2018-09-07 08:01:47 UTC (rev 73283)
+++ grass/trunk/imagery/i.segment/iseg.h 2018-09-07 15:56:59 UTC (rev 73284)
@@ -110,7 +110,7 @@
/* region growing internal structure */
struct RG_TREE *reg_tree; /* search tree with region stats */
- int min_reg_size; /* minimum region size */
+ LARGEINT min_reg_size; /* minimum region size */
struct reg_stats rs, rs_i, rs_k;
struct ngbr_stats ns;
Modified: grass/trunk/imagery/i.segment/open_files.c
===================================================================
--- grass/trunk/imagery/i.segment/open_files.c 2018-09-07 08:01:47 UTC (rev 73283)
+++ grass/trunk/imagery/i.segment/open_files.c 2018-09-07 15:56:59 UTC (rev 73284)
@@ -508,7 +508,8 @@
static int manage_memory(int srows, int scols, struct globals *globals)
{
double reg_size_mb, segs_mb;
- int reg_size_count, nseg, nseg_total;
+ LARGEINT reg_size_count;
+ int nseg, nseg_total;
segs_mb = globals->mb;
if (globals->method == ORM_RG) {
@@ -546,6 +547,7 @@
}
/* calculate number of segments in memory */
+ /* nseg: integer overflow possible with large segs_mb */
if (globals->bounds_map != NULL) {
/* input bands, segment ids, bounds map */
if (globals->method == ORM_MS) {
More information about the grass-commit
mailing list