[Dart-dev] [5590] DART/trunk/models/wrf/WRF_BC/module_netcdf_interface.f90: There were no tests on the number of times in the netcdf file,

nancy at ucar.edu nancy at ucar.edu
Tue Mar 6 14:52:15 MST 2012


Revision: 5590
Author:   nancy
Date:     2012-03-06 14:52:15 -0700 (Tue, 06 Mar 2012)
Log Message:
-----------
There were no tests on the number of times in the netcdf file,
and if it exceeded the fixed upper limit it just wrote over
memory beyond the array ends.  Now gives a fatal error and
suggests what varible to change to increase the max number of
times supported in the input netcdf file.  this module is
used by pert_wrf_bc and update_wrf_bc.  (same fix as on kodiak branch)

Modified Paths:
--------------
    DART/trunk/models/wrf/WRF_BC/module_netcdf_interface.f90

-------------- next part --------------
Modified: DART/trunk/models/wrf/WRF_BC/module_netcdf_interface.f90
===================================================================
--- DART/trunk/models/wrf/WRF_BC/module_netcdf_interface.f90	2012-03-06 21:49:56 UTC (rev 5589)
+++ DART/trunk/models/wrf/WRF_BC/module_netcdf_interface.f90	2012-03-06 21:52:15 UTC (rev 5590)
@@ -35,6 +35,7 @@
    revision = "$Revision$", &
    revdate  = "$Date$"
 
+character(len=128) :: errstring
 
 CONTAINS
 
@@ -477,6 +478,13 @@
 !  get the times
 
   n_times = idims(2)
+  if (n_times > max_times) then
+    write(errstring, '(2(A,I6))') 'number of times in file ', n_times, &
+                                  '  is larger than allocated space ', max_times
+    call error_handler(E_ERR, 'get_times_cdf', errstring, source, revision, revdate, &
+                       text2='increase max_times in [pert,update]_wrf_bc.f90 and recompile')
+  endif
+
   do i=1,idims(2)
     istart(1) = 1
     iend(1) = idims(1)


More information about the Dart-dev mailing list