This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

src/gdb ChangeLog exec.c testsuite/ChangeLog t ...


CVSROOT:	/cvs/src
Module name:	src
Changes by:	brobecke@sourceware.org	2012-11-26 17:41:44

Modified files:
	gdb            : ChangeLog exec.c 
	gdb/testsuite  : ChangeLog 
Added files:
	gdb/testsuite/gdb.base: empty_exe.exp 

Log message:
	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
	to fail.
	
	The fix is to enable the associated cleanup after we have verified
	that openp was successful.
	
	gdb/ChangeLog (By Keith Seitz  <keiths@redhat.com>):
	
	* exec.c (exec_file_attach): Move cleanup after verifying that
	memory has in fact been allocated.
	
	gdb/testsuite/ChangeLog:
	
	* gdb.base/empty_exe.exp: New testcase.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.14855&r2=1.14856
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/exec.c.diff?cvsroot=src&r1=1.119&r2=1.120
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3462&r2=1.3463
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/empty_exe.exp.diff?cvsroot=src&r1=NONE&r2=1.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]