Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] AIX: Fix buffer overflow in fill_fprs
@ 2012-03-08 13:16 Chris January
  2012-03-13 22:36 ` Joel Brobecker
  0 siblings, 1 reply; 2+ messages in thread
From: Chris January @ 2012-03-08 13:16 UTC (permalink / raw)
  To: gdb-patches

The callers of fill_fprs expect the first floating point register to be
written to vals[0], but it's currently written to
vals[tdep->ppc_fp0_regnum] which can cause GDB to segfault as the
caller's buffer overflows.

2012-03-08  Chris January  <chris.january@allinea.com>

	* aix-thread.c (fill_sprs): Store the floating point registers at the
correct offsets into vals.
---
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 0a9fae3..0c697f7 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -1356,7 +1356,8 @@ fill_fprs (const struct regcache *regcache, double
*vals)
        regno < tdep->ppc_fp0_regnum + ppc_num_fprs;
        regno++)
     if (REG_VALID == regcache_register_status (regcache, regno))
-      regcache_raw_collect (regcache, regno, vals + regno);
+      regcache_raw_collect (regcache, regno,
+			    vals + regno - tdep->ppc_fp0_regnum);
 }
 
 /* Store the special registers into the specified 64-bit and 32-bit



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

end of thread, other threads:[~2012-03-13 22:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-08 13:16 [PATCH] AIX: Fix buffer overflow in fill_fprs Chris January
2012-03-13 22:36 ` Joel Brobecker

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