diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-07-14 20:26:06 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-07-14 20:26:06 +0000 |
commit | 98044b92eea77974a5c557d3582098a2fc9f32a7 (patch) | |
tree | ee02c3ee48d669a7eb32f32bdba9440b622651bc /libgfortran | |
parent | 5f1adf54e257693b2405afaa6db133c6965a0022 (diff) | |
download | gcc-98044b92eea77974a5c557d3582098a2fc9f32a7.tar.gz |
PR 66861 Fix null pointer crash on mingw.
2015-07-14 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/66861
* io/unix.c (compare_file_filename): Verify that u->filename is
non-NULL before strcmp.
(find_file0): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225788 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 7 | ||||
-rw-r--r-- | libgfortran/io/unix.c | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index ae0d85328c7..876b2c92f8a 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2015-07-14 Janne Blomqvist <jb@gcc.gnu.org> + + PR libfortran/66861 + * io/unix.c (compare_file_filename): Verify that u->filename is + non-NULL before strcmp. + (find_file0): Likewise. + 2015-07-06 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> PR libfortran/40267 diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index e5fc6e19818..a1ce9a3ffe7 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -1525,7 +1525,10 @@ compare_file_filename (gfc_unit *u, const char *name, int len) goto done; } # endif - ret = (strcmp(path, u->filename) == 0); + if (u->filename) + ret = (strcmp(path, u->filename) == 0); + else + ret = 0; #endif done: free (path); @@ -1570,7 +1573,7 @@ find_file0 (gfc_unit *u, FIND_FILE0_DECL) } else # endif - if (strcmp (u->filename, path) == 0) + if (u->filename && strcmp (u->filename, path) == 0) return u; #endif |