public inbox for rda@sourceware.org
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: rda@sources.redhat.com
Subject: committed: add asserts to linux_get_reg
Date: Fri, 11 Mar 2005 21:12:00 -0000	[thread overview]
Message-ID: <vt2psy5ubym.fsf@zenia.home> (raw)


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

                 reply	other threads:[~2005-03-11 21:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vt2psy5ubym.fsf@zenia.home \
    --to=jimb@redhat.com \
    --cc=rda@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).