[GRASS-SVN] r70736 - grass-addons/grass7/raster/r.series.lwr

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Mar 10 01:27:49 PST 2017


Author: mmetz
Date: 2017-03-10 01:27:49 -0800 (Fri, 10 Mar 2017)
New Revision: 70736

Modified:
   grass-addons/grass7/raster/r.series.lwr/main.c
Log:
r.series.lwr: fix out-of-bounds array index

Modified: grass-addons/grass7/raster/r.series.lwr/main.c
===================================================================
--- grass-addons/grass7/raster/r.series.lwr/main.c	2017-03-07 16:41:56 UTC (rev 70735)
+++ grass-addons/grass7/raster/r.series.lwr/main.c	2017-03-10 09:27:49 UTC (rev 70736)
@@ -621,17 +621,12 @@
 				prev_ts = ts[i] - (ts[i] - ts[i - 1]) / 2.0;
 			    else
 				prev_ts = ts[i] - (ts[i + 1] - ts[i]) / 2.0;
-			    
-			    if (i < num_inputs - 1)
-				next_ts = ts[i] + (ts[i + 1] - ts[i]) / 2.0;
-			    else
-				next_ts = ts[i] + (ts[i] - ts[i - 1]) / 2.0;
 
 			    j = i;
 			    while (j < num_inputs - 1 && isnull[j + 1])
 				j++;
 
-			    if (j > i)
+			    if (j < num_inputs - 1)
 				next_ts = ts[j] + (ts[j + 1] - ts[j]) / 2.0;
 			    else
 				next_ts = ts[j] + (ts[j] - ts[j - 1]) / 2.0;



More information about the grass-commit mailing list