[patch,fortran] PR69043 Trying to include a directory causes an infinite loop

Jerry DeLisle jvdelisle@charter.net
Sun Mar 13 17:42:00 GMT 2016


On 03/13/2016 01:15 AM, Bernhard Reutner-Fischer wrote:
> On March 13, 2016 3:22:53 AM GMT+01:00, Jerry DeLisle <jvdelisle@charter.net> wrote:
>> I plan to commit the attached patch and test case under simple and
>> obvious tomorrow.
> 
> First, the patch adds superfluous vertical whitespace.
> 
> Second, and I apologise for stating the obvious, I'd make that a whitelist instead, I.e only allow regular files or symlinks pointing to regular files as I think there are no sensible use cases for including e.g. block- or char devices et al. Including a pipe would maybe be possible to support but I doubt this is a usual usage pattern.
> 
> Thanks,
> 
> 

Thanks for your thought.

Done, tested with a link to a regular file, changed the error message just a bit.

New Revision: 234169

URL: https://gcc.gnu.org/viewcvs?rev=234169&root=gcc&view=rev
Log:
2016-03-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
	    Jim MacArthur  <jim.macarthur@codethink.co.uk>

	PR fortran/69043
	* scanner.c (load_file): Check that included file is regular.

	PR fortran/69043
	* gfortran.dg/include_9.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/include_9.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/scanner.c
    trunk/gcc/testsuite/ChangeLog



More information about the Fortran mailing list