[GRASS-SVN] r70982 - grass/trunk/raster/r.quantile

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Apr 28 08:05:23 PDT 2017


Author: mmetz
Date: 2017-04-28 08:05:23 -0700 (Fri, 28 Apr 2017)
New Revision: 70982

Modified:
   grass/trunk/raster/r.quantile/main.c
Log:
r.quantile: attempt to fix integer overflow

Modified: grass/trunk/raster/r.quantile/main.c
===================================================================
--- grass/trunk/raster/r.quantile/main.c	2017-04-28 13:34:00 UTC (rev 70981)
+++ grass/trunk/raster/r.quantile/main.c	2017-04-28 15:05:23 UTC (rev 70982)
@@ -18,11 +18,12 @@
 #include <grass/raster.h>
 #include <grass/glocale.h>
 
+/* TODO: replace long with either size_t or a guaranteed 64 bit integer */
 struct bin
 {
     unsigned long origin;
     DCELL min, max;
-    int base, count;
+    long base, count;
 };
 
 static int rows, cols;
@@ -34,7 +35,7 @@
 static unsigned int *slots;
 static DCELL slot_size;
 static unsigned long total;
-static int num_values;
+static size_t num_values;
 static unsigned short *slot_bins;
 static int num_bins;
 static struct bin *bins;



More information about the grass-commit mailing list