This is the mail archive of the
rda@sources.redhat.com
mailing list for the rda project.
committed: add asserts to linux_get_reg
- From: Jim Blandy <jimb at redhat dot com>
- To: rda at sources dot redhat dot com
- Date: 11 Mar 2005 16:09:05 -0500
- Subject: committed: add asserts to linux_get_reg
I've committed this as obvious.
rda/unix/ChangeLog:
2005-03-11 Jim Blandy <jimb@redhat.com>
* linux-target.c (linux_get_reg) [GETREGS_SETREGS_REGINFO]: In the
NOREGS case, check that reginfo doesn't specify an offset outside
our zeroed buffer.
Index: rda/unix/linux-target.c
===================================================================
RCS file: /cvs/src/src/rda/unix/linux-target.c,v
retrieving revision 1.15
diff -c -p -r1.15 linux-target.c
*** rda/unix/linux-target.c 10 Mar 2005 23:50:47 -0000 1.15
--- rda/unix/linux-target.c 11 Mar 2005 21:08:55 -0000
*************** linux_get_reg (struct gdbserv *serv, int
*** 1827,1835 ****
/* A buffer initialized to zeros we can refer to. */
static struct gdbserv_reg zeros;
! /* Make sure we're not going to try to copy out more than we have. */
assert (reginfo[regno].ptrace_size <= sizeof (zeros.buf));
buf = (char *) zeros.buf;
}
else
--- 1827,1841 ----
/* A buffer initialized to zeros we can refer to. */
static struct gdbserv_reg zeros;
! /* Make sure we're not going to try to copy out more bytes than
! we have. */
assert (reginfo[regno].ptrace_size <= sizeof (zeros.buf));
+ /* Make sure we don't have some random offset that will take us
+ beyond the end of the buffer. Offsets for NOREGS entries
+ should be zero. */
+ assert (reginfo[regno].offset == 0);
+
buf = (char *) zeros.buf;
}
else