From 07fc109c14de23eeadc166eec55d954d2993c8bd Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Fri, 4 Jun 2010 06:50:11 +0000 Subject: re PR libfortran/34670 (bounds checking for array intrinsics) 2010-06-04 Thomas Koenig PR libfortran/34670 * intrinsics/date_and_time.c: Replace assert with runtime_error when VALUE is too small. From-SVN: r160253 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/intrinsics/date_and_time.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'libgfortran') diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index e90848c..84675b9 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2010-06-04 Thomas Koenig + + PR libfortran/34670 + * intrinsics/date_and_time.c: Replace assert with runtime_error + when VALUE is too small. + 2010-05-20 Jerry DeLisle PR fortran/43851 diff --git a/libgfortran/intrinsics/date_and_time.c b/libgfortran/intrinsics/date_and_time.c index 647dd9a..21e4320 100644 --- a/libgfortran/intrinsics/date_and_time.c +++ b/libgfortran/intrinsics/date_and_time.c @@ -280,8 +280,12 @@ date_and_time (char *__date, char *__time, char *__zone, delta = GFC_DESCRIPTOR_STRIDE(__values,0); if (delta == 0) delta = 1; + + if (unlikely (len < VALUES_SIZE)) + runtime_error ("Incorrect extent in VALUE argument to" + " DATE_AND_TIME intrinsic: is %ld, should" + " be >=%ld", (long int) len, (long int) VALUES_SIZE); - assert (len >= VALUES_SIZE); /* Cope with different type kinds. */ if (elt_size == 4) { -- cgit v1.1