Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa] fix invidious casting bug in infptrace.c with 64-bit CORE_ADDR
@ 2001-07-25 17:30 Daniel Jacobowitz
  2001-07-25 19:01 ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2001-07-25 17:30 UTC (permalink / raw)
  To: gdb-patches

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)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-07-25 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-25 17:30 [rfa] fix invidious casting bug in infptrace.c with 64-bit CORE_ADDR Daniel Jacobowitz
2001-07-25 19:01 ` Andrew Cagney
2001-07-25 19:24   ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox