aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2015-01-24 23:52:34 +0200
committerJanne Blomqvist <jb@gcc.gnu.org>2015-01-24 23:52:34 +0200
commit7165d8f1916979828be6e913a2a0d19d2923ffd0 (patch)
tree0c3d1d607e4cba288e848924dd2fb81811380302 /libgfortran
parentd773ed85c56fbae24f13b4e4a054fcc7ca1550f7 (diff)
downloadgcc-7165d8f1916979828be6e913a2a0d19d2923ffd0.zip
gcc-7165d8f1916979828be6e913a2a0d19d2923ffd0.tar.gz
gcc-7165d8f1916979828be6e913a2a0d19d2923ffd0.tar.bz2
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. From-SVN: r220086
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 04f85c7..e228a67 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 e168d32..687f507 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;