mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 03:51:15 +08:00
2008-09-19 Andrew Stubbs <ams@codesourcery.com>
* frame.c (get_frame_register_bytes): Detect bad debug info.
This commit is contained in:
parent
5db484ff3d
commit
3f27f2a479
@ -1,3 +1,7 @@
|
||||
2008-09-19 Andrew Stubbs <ams@codesourcery.com>
|
||||
|
||||
* frame.c (get_frame_register_bytes): Detect bad debug info.
|
||||
|
||||
2008-09-17 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Fix a crash on uninitialized ECS->EVENT_THREAD for a newly found thread.
|
||||
|
18
gdb/frame.c
18
gdb/frame.c
@ -796,6 +796,8 @@ get_frame_register_bytes (struct frame_info *frame, int regnum,
|
||||
CORE_ADDR offset, int len, gdb_byte *myaddr)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||
int i;
|
||||
int maxsize;
|
||||
|
||||
/* Skip registers wholly inside of OFFSET. */
|
||||
while (offset >= register_size (gdbarch, regnum))
|
||||
@ -804,6 +806,22 @@ get_frame_register_bytes (struct frame_info *frame, int regnum,
|
||||
regnum++;
|
||||
}
|
||||
|
||||
/* Detect bad debug info. */
|
||||
maxsize = -offset;
|
||||
for (i = regnum; i < gdbarch_num_regs (gdbarch); i++)
|
||||
{
|
||||
int thissize = register_size (gdbarch, i);
|
||||
if (thissize == 0)
|
||||
break;
|
||||
maxsize += thissize;
|
||||
}
|
||||
if (len > maxsize)
|
||||
{
|
||||
warning (_("Bad debug information detected: "
|
||||
"Attempt to read %d bytes from registers."), len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Copy the data. */
|
||||
while (len > 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user