[GRASS-SVN] r71615 - grass/branches/releasebranch_7_2/raster/r.watershed/seg

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 30 14:44:50 PDT 2017


Author: mmetz
Date: 2017-10-30 14:44:50 -0700 (Mon, 30 Oct 2017)
New Revision: 71615

Modified:
   grass/branches/releasebranch_7_2/raster/r.watershed/seg/init_vars.c
Log:
r.watershed: reduce chance of integer overflow (backport trunk r71614)

Modified: grass/branches/releasebranch_7_2/raster/r.watershed/seg/init_vars.c
===================================================================
--- grass/branches/releasebranch_7_2/raster/r.watershed/seg/init_vars.c	2017-10-30 21:43:49 UTC (rev 71614)
+++ grass/branches/releasebranch_7_2/raster/r.watershed/seg/init_vars.c	2017-10-30 21:44:50 UTC (rev 71615)
@@ -430,7 +430,7 @@
 
     G_debug(1, "open segments for A* points");
     /* columns per segment */
-    seg_cols = seg_rows * seg_rows;
+    seg_cols = seg_rows * 200; /* check for integer overflow ? */
     num_cseg_total = do_points / seg_cols;
     if (do_points % seg_cols > 0)
 	num_cseg_total++;
@@ -449,7 +449,7 @@
     G_debug(1, "heap memory %.2f MB", heap_mem);
     /* columns per segment */
     /* larger is faster */
-    seg_cols = seg_rows * seg_rows;
+    seg_cols = seg_rows * 300; /* check for integer overflow ? */
     num_cseg_total = do_points / seg_cols;
     if (do_points % seg_cols > 0)
 	num_cseg_total++;



More information about the grass-commit mailing list