From d33fc4e447bc1a277ab1e49b7a7d39e07f01f33e Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Tue, 8 Jan 2002 02:04:12 +0000 Subject: 2002-01-07 Michael Snyder * infptrace.c (GDB_MAX_ALLOCA): New define. (child_xfer_memory): Use xmalloc/xfree instead of alloca if the size of the buffer exceeds GDB_MAX_ALLOCA (default 1 megabyte, can be overridden with whatever value is appropriate to the host). * infttrace.c (child_xfer_memory): Add FIXME warning about use of alloca to allocate potentially large buffer. * rs6000-nat.c (child_xfer_memory): Ditto. * symm-nat.c (child_xfer_memory): Ditto. * x86-64-linux-nat.c (child_xfer_memory): Ditto. --- gdb/rs6000-nat.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gdb/rs6000-nat.c') diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 12229cd..94daaff 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -407,6 +407,9 @@ child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, / sizeof (int); /* Allocate word transfer buffer. */ + /* FIXME (alloca): This code, cloned from infptrace.c, is unsafe + because it uses alloca to allocate a buffer of arbitrary size. + For very large xfers, this could crash GDB's stack. */ int *buf = (int *) alloca (count * sizeof (int)); int arch64 = ARCH64 (); -- cgit v1.1