Commit cacf2b96 by Jerry DeLisle

re PR libfortran/27575 (gfortran - does not generate error when trying to read too much data)

2006-05-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/27575
	* io/transfer.c (read_block):  Add check for end file condition.
	(read_block_direct): Add check for end file condition.

From-SVN: r113837
parent de1f8a0d
2006-05-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/27575
* io/transfer.c (read_block): Add check for end file condition.
(read_block_direct): Add check for end file condition.
2006-05-05 Francois-Xavier Coudert <coudert@clipper.ens.fr> 2006-05-05 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/26985 PR libfortran/26985
......
...@@ -272,6 +272,13 @@ read_block (st_parameter_dt *dtp, int *length) ...@@ -272,6 +272,13 @@ read_block (st_parameter_dt *dtp, int *length)
} }
} }
if (dtp->u.p.current_unit->bytes_left == 0)
{
dtp->u.p.current_unit->endfile = AT_ENDFILE;
generate_error (&dtp->common, ERROR_END, NULL);
return;
}
*length = dtp->u.p.current_unit->bytes_left; *length = dtp->u.p.current_unit->bytes_left;
} }
...@@ -328,6 +335,13 @@ read_block_direct (st_parameter_dt *dtp, void *buf, size_t *nbytes) ...@@ -328,6 +335,13 @@ read_block_direct (st_parameter_dt *dtp, void *buf, size_t *nbytes)
} }
} }
if (dtp->u.p.current_unit->bytes_left == 0)
{
dtp->u.p.current_unit->endfile = AT_ENDFILE;
generate_error (&dtp->common, ERROR_END, NULL);
return;
}
*nbytes = dtp->u.p.current_unit->bytes_left; *nbytes = dtp->u.p.current_unit->bytes_left;
} }
......
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