[GRASS-SVN] r74199 - grass/trunk/vector/v.vect.stats

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 9 06:33:37 PST 2019


Author: mmetz
Date: 2019-03-09 06:33:37 -0800 (Sat, 09 Mar 2019)
New Revision: 74199

Modified:
   grass/trunk/vector/v.vect.stats/main.c
Log:
v.vect.stats: prevent integer overflow

Modified: grass/trunk/vector/v.vect.stats/main.c
===================================================================
--- grass/trunk/vector/v.vect.stats/main.c	2019-03-09 14:28:54 UTC (rev 74198)
+++ grass/trunk/vector/v.vect.stats/main.c	2019-03-09 14:33:37 UTC (rev 74199)
@@ -68,7 +68,10 @@
     AREA_CAT *p1 = (AREA_CAT *) pa;
     AREA_CAT *p2 = (AREA_CAT *) pb;
 
-    return (p1->area_cat - p2->area_cat);
+    if (p1->area_cat < p2->area_cat)
+	return -1;
+
+    return (p1->area_cat > p2->area_cat);
 }
 
 int main(int argc, char *argv[])



More information about the grass-commit mailing list