This is the mail archive of the
mailing list for the GDB project.
src/gdb ChangeLog exec.c testsuite/ChangeLog t ...
- From: brobecke at sourceware dot org
- To: gdb-cvs at sourceware dot org
- Date: 26 Nov 2012 17:41:44 -0000
- Subject: src/gdb ChangeLog exec.c testsuite/ChangeLog t ...
Module name: src
Changes by: email@example.com 2012-11-26 17:41:44
gdb : ChangeLog exec.c
gdb/testsuite : ChangeLog
Do not crash when calling GDB with empty executable name.
% gdb -q ''
... or ...
% gdb -q
(gdb) file ''
... both cause GDB to crash with an invalid free. This is because
exec_file_attach is attempting to free a string that has not been
allocated. The string is only allocated if openp is successful.
But in the case of this obviously invalid filename, openp fails,
and leaves scratch_pathname uninitialized, thus causing the xfree
The fix is to enable the associated cleanup after we have verified
that openp was successful.
gdb/ChangeLog (By Keith Seitz <firstname.lastname@example.org>):
* exec.c (exec_file_attach): Move cleanup after verifying that
memory has in fact been allocated.
* gdb.base/empty_exe.exp: New testcase.