[GRASS-SVN] r73378 - in grass/trunk: lib/raster raster/r.buildvrt
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Sep 21 08:43:19 PDT 2018
Author: mmetz
Date: 2018-09-21 08:43:19 -0700 (Fri, 21 Sep 2018)
New Revision: 73378
Modified:
grass/trunk/lib/raster/vrt.c
grass/trunk/raster/r.buildvrt/main.c
Log:
virtual raster: avoid recursion to self
Modified: grass/trunk/lib/raster/vrt.c
===================================================================
--- grass/trunk/lib/raster/vrt.c 2018-09-21 14:44:44 UTC (rev 73377)
+++ grass/trunk/lib/raster/vrt.c 2018-09-21 15:43:19 UTC (rev 73378)
@@ -1,7 +1,7 @@
/*!
- \file lib/raster/gdal.c
+ \file lib/raster/vrt.c
- \brief Raster Library - Utilization of GDAL library.
+ \brief Raster Library - virtual GRASS raster maps.
(C) 2010 by the GRASS Development Team
@@ -82,6 +82,9 @@
if ((mapset = G_find_raster(name, "")) == NULL)
G_fatal_error(_("Tile raster map <%s> not found"), name);
+ if (strcmp(name, vname) == 0)
+ G_fatal_error(_("A virtual raster can not contain itself"));
+
if (tilecount >= talloc) {
talloc += 100;
ti = G_realloc(ti, talloc * sizeof(struct tileinfo));
Modified: grass/trunk/raster/r.buildvrt/main.c
===================================================================
--- grass/trunk/raster/r.buildvrt/main.c 2018-09-21 14:44:44 UTC (rev 73377)
+++ grass/trunk/raster/r.buildvrt/main.c 2018-09-21 15:43:19 UTC (rev 73378)
@@ -146,6 +146,9 @@
if ((mapset = G_find_raster(name, "")) == NULL)
G_fatal_error(_("Input raster map <%s> not found"), name);
+ if (strcmp(name, parm.output->answer) == 0)
+ G_fatal_error(_("Input and output raster map can not be identical"));
+
Rast_read_fp_range(name, mapset, &fprange);
dmin = fprange.min;
if (Rast_is_d_null_value(&dmin)) {
@@ -196,6 +199,9 @@
if ((mapset = G_find_raster(name, "")) == NULL)
G_fatal_error(_("Input raster map <%s> not found"), name);
+ if (strcmp(name, parm.output->answer) == 0)
+ G_fatal_error(_("Input and output raster map can not be identical"));
+
Rast_read_fp_range(name, mapset, &fprange);
dmin = fprange.min;
if (Rast_is_d_null_value(&dmin)) {
More information about the grass-commit
mailing list