public inbox for rda@sourceware.org
 help / color / mirror / Atom feed
* committed: add asserts to linux_get_reg
@ 2005-03-11 21:12 Jim Blandy
  0 siblings, 0 replies; only message in thread
From: Jim Blandy @ 2005-03-11 21:12 UTC (permalink / raw)
  To: rda


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-03-11 21:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-11 21:12 committed: add asserts to linux_get_reg Jim Blandy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).