Initial revision

This commit is contained in:
aoliva 2006-09-04 07:38:09 +00:00
parent 753f5e6d3e
commit 9bd4e90e66
1 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,49 @@
for gdb/ChangeLog:
2006-08-14 Will Drewry <wad@google.com>
* dwarf2read.c (decode_locdesc): Avoid overflows in expression
stack.
* dwarfread.c (locval): Likewise.
Index: gdb-6.5/gdb/dwarf2read.c
===================================================================
--- gdb-6.5.orig/gdb/dwarf2read.c 2006-08-23 04:12:09.000000000 -0300
+++ gdb-6.5/gdb/dwarf2read.c 2006-08-23 04:16:17.000000000 -0300
@@ -8864,6 +8864,16 @@ decode_locdesc (struct dwarf_block *blk,
dwarf_stack_op_name (op));
return (stack[stacki]);
}
+
+ /* Enforce maximum stack depth of 63 to avoid ++stacki writing
+ outside of the given size. Also enforce minimum > 0. */
+ if (stacki >= sizeof(stack)/sizeof(*stack) - 1)
+ internal_error (__FILE__, __LINE__,
+ _("location description stack too deep: %d"),
+ stacki);
+ if (stacki <= 0)
+ internal_error (__FILE__, __LINE__,
+ _("location description stack too shallow"));
}
return (stack[stacki]);
}
Index: gdb-6.5/gdb/dwarfread.c
===================================================================
--- gdb-6.5.orig/gdb/dwarfread.c 2005-12-17 20:33:59.000000000 -0200
+++ gdb-6.5/gdb/dwarfread.c 2006-08-23 04:17:24.000000000 -0300
@@ -2224,6 +2224,16 @@ locval (struct dieinfo *dip)
stacki--;
break;
}
+
+ /* Enforce maximum stack depth of 63 to avoid ++stacki writing
+ outside of the given size. Also enforce minimum > 0. */
+ if (stacki >= sizeof(stack)/sizeof(*stack) - 1)
+ internal_error (__FILE__, __LINE__,
+ _("location description stack too deep: %d"),
+ stacki);
+ if (stacki <= 0)
+ internal_error (__FILE__, __LINE__,
+ _("location description stack too shallow"));
}
return (stack[stacki]);
}