diff options
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/write_float.def | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 6260ed3..dcc52a5 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2008-02-20 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/35036 + * write_float.def (output_float): Add error checks for zero digits + after decimal point in E and D format specifiers. + 2008-02-10 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/35063 diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def index 4642013..028fd27 100644 --- a/libgfortran/io/write_float.def +++ b/libgfortran/io/write_float.def @@ -167,6 +167,19 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, case FMT_E: case FMT_D: i = dtp->u.p.scale_factor; + if (d <= 0 && i == 0) + { + generate_error (&dtp->common, LIBERROR_FORMAT, "Precision not " + "greater than zero in format specifier 'E' or 'D'"); + return; + } + if (i <= -d || i >= d + 2) + { + generate_error (&dtp->common, LIBERROR_FORMAT, "Scale factor " + "out of range in format specifier 'E' or 'D'"); + return; + } + if (!zero_flag) e -= i; if (i < 0) |