Commit 5f6a7599 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gribapiDefDateTimeRel: check range of endStep (bug fix).

parent 2b7df291
......@@ -2,6 +2,10 @@
* Version 1.9.4 released
2018-04-25 Uwe Schulzweida
* gribapiDefDateTimeRel: check range of endStep (bug fix)
2018-04-03 Uwe Schulzweida
* Added streamReadVarPart() and streamReadVarSlicePart() [patch from: Niklas Rber]
......
......@@ -1817,7 +1817,9 @@ int gribapiDefDateTimeRel(int editionNumber, grib_handle *gh, int rdate, int rti
gribapiDefStepUnits(editionNumber, gh, timeunit, proDefTempNum, gcinit);
long startStep = 0;
long endStep = (long) ((days*86400.0 + secs)/factor);
double endStepF = (days*86400.0 + secs)/factor;
if ( endStepF > INT_MAX ) return status;
long endStep = (long) endStepF;
if ( editionNumber > 1 ) GRIB_CHECK(my_grib_set_long(gh, "significanceOfReferenceTime", 1), 0);
if ( editionNumber > 1 ) GRIB_CHECK(my_grib_set_long(gh, "stepRange", 0), 0);
......@@ -1870,8 +1872,8 @@ void gribapiDefTime(int editionNumber, int productDefinitionTemplate, int typeOf
int rtime = taxisInqRtime(taxisID);
int timeunit = taxisInqTunit(taxisID);
int status = gribapiDefDateTimeRel(editionNumber, gh, rdate, rtime, vdate, vtime,
productDefinitionTemplate, typeOfGeneratingProcess, tsteptype, timeunit, calendar, gcinit);
int status = gribapiDefDateTimeRel(editionNumber, gh, rdate, rtime, vdate, vtime, productDefinitionTemplate,
typeOfGeneratingProcess, tsteptype, timeunit, calendar, gcinit);
if ( status != 0 ) taxistype = TAXIS_ABSOLUTE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment