[GRASS-SVN] r73047 - grass/branches/releasebranch_7_4/vector/v.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 3 14:56:57 PDT 2018


Author: mmetz
Date: 2018-08-03 14:56:57 -0700 (Fri, 03 Aug 2018)
New Revision: 73047

Modified:
   grass/branches/releasebranch_7_4/vector/v.in.ogr/main.c
Log:
v.in.ogr: fix segfault with wrong array index; fix counter for G_percent() (backport trunk r73002, 12)

Modified: grass/branches/releasebranch_7_4/vector/v.in.ogr/main.c
===================================================================
--- grass/branches/releasebranch_7_4/vector/v.in.ogr/main.c	2018-08-03 21:52:23 UTC (rev 73046)
+++ grass/branches/releasebranch_7_4/vector/v.in.ogr/main.c	2018-08-03 21:56:57 UTC (rev 73047)
@@ -759,10 +759,10 @@
 	feature_count = 0;
 
 	ogr_feature_count = 0;
-	if (n_features[layer_id] == 0)
+	if (n_features[layer] == 0)
 	    ogr_feature_count = OGR_L_GetFeatureCount(Ogr_layer, 1);
 	if (ogr_feature_count > 0)
-	    n_features[layer_id] = ogr_feature_count;
+	    n_features[layer] = ogr_feature_count;
 
 	/* count polygons and isles */
 	G_message(_("Check if OGR layer <%s> contains polygons..."),
@@ -1525,11 +1525,12 @@
 #endif
 
 	    cat = 0;		/* field = layer + 1 */
+	    feature_count = 0;
 	    while ((Ogr_feature = ogr_getnextfeature(&OGR_iter, layer_id,
 						     layer_names[layer],
 						     poSpatialFilter[layer],
 						     attr_filter)) != NULL) {
-		G_percent(cat, n_features[layer], 2);
+		G_percent(feature_count++, n_features[layer], 2);
 
 		/* Category */
 		if (key_idx[layer] > -1)



More information about the grass-commit mailing list