diff options
author | Joel Brobecker <brobecker@gnat.com> | 2010-01-08 13:54:40 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2010-01-08 13:54:40 +0000 |
commit | f91e5ac34e150aeb5030c1005a510a231449c33c (patch) | |
tree | b5fd1ec7d001b8d3f486ab84d66a480cd7db4f3a | |
parent | 2de75e717cf6e60bcaf9ec42e92bb6a9d43d96d5 (diff) | |
download | gdb-f91e5ac34e150aeb5030c1005a510a231449c33c.zip gdb-f91e5ac34e150aeb5030c1005a510a231449c33c.tar.gz gdb-f91e5ac34e150aeb5030c1005a510a231449c33c.tar.bz2 |
GDB crash with empty executable name (MinGW).
* source.c (openp): Add assert that parameter string is not NULL.
if parameter string is an empty string, then return with a failure
immediately.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/source.c | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 707b2f2..cb49ab9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2009-01-08 Joel Brobecker <brobecker@adacore.com> + GDB crash with empty executable name (MinGW). + * source.c (openp): Add assert that parameter string is not NULL. + if parameter string is an empty string, then return with a failure + immediately. + +2009-01-08 Joel Brobecker <brobecker@adacore.com> + Get rid of support for VAX Floats. * ada-lang.h (ada_is_vax_floating_type, ada_vax_float_type_suffix) (ada_vax_float_print_function): Delete. diff --git a/gdb/source.c b/gdb/source.c index fcfce65..2090326 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -707,6 +707,20 @@ openp (const char *path, int opts, const char *string, /* The open syscall MODE parameter is not specified. */ gdb_assert ((mode & O_CREAT) == 0); + gdb_assert (string != NULL); + + /* A file with an empty name cannot possibly exist. Report a failure + without further checking. + + This is an optimization which also defends us against buggy + implementations of the "stat" function. For instance, we have + noticed that a MinGW debugger built on Windows XP 32bits crashes + when the debugger is started with an empty argument. */ + if (string[0] == '\0') + { + errno = ENOENT; + return -1; + } if (!path) path = "."; |