summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-24 21:52:34 +0000
committerjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-24 21:52:34 +0000
commitf100306fa18fa53178f59d1114e6eedfa37abc30 (patch)
tree0c3d1d607e4cba288e848924dd2fb81811380302 /libgfortran
parentda9fc4922b66a8f2ef6b57e5313c19fdf17f3403 (diff)
downloadgcc-f100306fa18fa53178f59d1114e6eedfa37abc30.tar.gz
PR libfortran/64770 Segfault when trying to open existing file with status="new".
libgfortran ChangeLog: 2015-01-24 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/64770 * io/unit.c (filename_from_unit): Check that u->filename != NULL before calling strdup. testsuite ChangeLog: 2015-01-24 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/64770 * gfortran.dg/open_new_segv.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/unit.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 04f85c7c46c..e228a677105 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-24 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR libfortran/64770
+ * io/unit.c (filename_from_unit): Check that u->filename != NULL
+ before calling strdup.
+
2015-01-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/61933
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index e168d328665..687f5076a5b 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -829,7 +829,7 @@ filename_from_unit (int n)
}
/* Get the filename. */
- if (u != NULL)
+ if (u != NULL && u->filename != NULL)
return strdup (u->filename);
else
return (char *) NULL;