Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dmj+@andrew.cmu.edu>
To: gdb-patches@sources.redhat.com
Subject: [rfa] fix invidious casting bug in infptrace.c with 64-bit CORE_ADDR
Date: Wed, 25 Jul 2001 17:30:00 -0000	[thread overview]
Message-ID: <20010725173040.A25389@nevyn.them.org> (raw)

This causes all sorts of interesting problems if memaddr happens to be, say,
0x17fffff00 (i.e. 33 bits).  There's something else wrong that memaddr was
so large, since ptrace on MIPS/Linux will truncate it back to 32-bit anyway,
but we still shouldn't let this happen.  memaddr and addr end up 4G apart,
and count is unimaginably too large.

OK to commit?


-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2001-07-25  Daniel Jacobowitz  <drow@mvista.com>

	* infptrace.c (child_xfer_memory): Add cast to CORE_ADDR.

Index: infptrace.c
===================================================================
RCS file: /cvs/src/src/gdb/infptrace.c,v
retrieving revision 1.16
diff -u -r1.16 infptrace.c
--- infptrace.c	2001/06/15 23:50:46	1.16
+++ infptrace.c	2001/07/26 00:26:56
@@ -497,7 +497,7 @@
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (PTRACE_XFER_TYPE);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1)


             reply	other threads:[~2001-07-25 17:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-25 17:30 Daniel Jacobowitz [this message]
2001-07-25 19:01 ` Andrew Cagney
2001-07-25 19:24   ` Daniel Jacobowitz

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=20010725173040.A25389@nevyn.them.org \
    --to=dmj+@andrew.cmu.edu \
    --cc=gdb-patches@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