[GRASS-SVN] r73286 - grass/branches/releasebranch_7_4/imagery/i.segment
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Sep 7 08:57:48 PDT 2018
Author: mmetz
Date: 2018-09-07 08:57:47 -0700 (Fri, 07 Sep 2018)
New Revision: 73286
Modified:
grass/branches/releasebranch_7_4/imagery/i.segment/iseg.h
grass/branches/releasebranch_7_4/imagery/i.segment/open_files.c
Log:
i.segment: avoid integer overflow with extremely large regions (backport trunk r73284)
Modified: grass/branches/releasebranch_7_4/imagery/i.segment/iseg.h
===================================================================
--- grass/branches/releasebranch_7_4/imagery/i.segment/iseg.h 2018-09-07 15:57:35 UTC (rev 73285)
+++ grass/branches/releasebranch_7_4/imagery/i.segment/iseg.h 2018-09-07 15:57:47 UTC (rev 73286)
@@ -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/branches/releasebranch_7_4/imagery/i.segment/open_files.c
===================================================================
--- grass/branches/releasebranch_7_4/imagery/i.segment/open_files.c 2018-09-07 15:57:35 UTC (rev 73285)
+++ grass/branches/releasebranch_7_4/imagery/i.segment/open_files.c 2018-09-07 15:57:47 UTC (rev 73286)
@@ -522,7 +522,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) {
@@ -560,6 +561,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