From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5416 invoked by alias); 11 Mar 2005 21:12:19 -0000 Mailing-List: contact rda-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: rda-owner@sources.redhat.com Received: (qmail 5385 invoked from network); 11 Mar 2005 21:12:17 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 11 Mar 2005 21:12:17 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j2BLCHgg015691 for ; Fri, 11 Mar 2005 16:12:17 -0500 Received: from zenia.home.redhat.com (sebastian-int.corp.redhat.com [172.16.52.221]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j2BLCFn05917; Fri, 11 Mar 2005 16:12:16 -0500 To: rda@sources.redhat.com Subject: committed: add asserts to linux_get_reg From: Jim Blandy Date: Fri, 11 Mar 2005 21:12:00 -0000 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-q1/txt/msg00008.txt.bz2 I've committed this as obvious. rda/unix/ChangeLog: 2005-03-11 Jim Blandy * 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