Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [obv] Fix crash in c_get_string
@ 2009-04-14 22:02 Jan Kratochvil
  2009-04-14 22:59 ` Thiago Jung Bauermann
  2009-04-15 17:43 ` Tom Tromey
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Kratochvil @ 2009-04-14 22:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Thiago Jung Bauermann

Hi,

during a failed string read - as when pretty-printing uninitialized
std::string - GDB could crash.

I have a testcase requiring GDB pretty-printing which is not in FSF GDB now so
the test should get in later.  Did not check how to reproduce it more easily.

Checked-in as: http://sourceware.org/ml/gdb-cvs/2009-04/msg00077.html

Original bugreport at: https://bugzilla.redhat.com/show_bug.cgi?id=495781

read_string comment:
   Unless an exception is thrown, BUFFER will always be allocated, even on 
   failure.


Regards,
Jan


gdb/
2009-04-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* c-lang.c (c_get_string): Fix xfree crash on a failed string read.

--- src/gdb/c-lang.c	2009/03/21 00:46:17	1.63
+++ src/gdb/c-lang.c	2009/04/14 21:54:33	1.64
@@ -657,7 +657,7 @@
 			 buffer, length);
       if (err)
 	{
-	  xfree (buffer);
+	  xfree (*buffer);
 	  error (_("Error reading string from inferior: %s"),
 		 safe_strerror (err));
 	}


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-04-15 17:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-14 22:02 [obv] Fix crash in c_get_string Jan Kratochvil
2009-04-14 22:59 ` Thiago Jung Bauermann
2009-04-15 17:43 ` Tom Tromey
2009-04-15 17:53   ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox