Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] [gdbserver] Fix memory corruption
@ 2011-03-01 21:34 Jan Kratochvil
  2011-03-02 15:35 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2011-03-01 21:34 UTC (permalink / raw)
  To: gdb-patches

Hi,

gdb.server/ext-run.exp always crashes during the nightly regression tests:
	info os processes
	memory clobbered past end of allocated block
	Remote communication error.  Target disconnected.: Connection reset by peer.
	(gdb) FAIL: gdb.server/ext-run.exp: get process list (pattern 1)

Probably OK to check in but I rather ask.

To make it easily reproducible one can disable try_rle() by patching it:
+return 1;
   /* Don't go past '~'.  */

So that putpkt_binary_1's cnt == 16383 will overrun PBUFSIZ 16384 by 4 bytes.


Thanks,
Jan


gdb/gdbserver/
2011-03-01  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* remote-utils.c (putpkt_binary_1): Calculate BUF2 size dynamically.

--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -725,7 +725,7 @@ putpkt_binary_1 (char *buf, int cnt, int is_notif)
   char *p;
   int cc;
 
-  buf2 = xmalloc (PBUFSIZ);
+  buf2 = xmalloc (1 + cnt + 4);
 
   /* Copy the packet into buffer BUF2, encapsulating it
      and giving it a checksum.  */


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

end of thread, other threads:[~2011-03-07 20:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-01 21:34 [patch] [gdbserver] Fix memory corruption Jan Kratochvil
2011-03-02 15:35 ` Pedro Alves
2011-03-02 16:51   ` Jan Kratochvil
2011-03-02 18:00     ` Pedro Alves
2011-03-07 20:26       ` Jan Kratochvil

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