50 lines
1.7 KiB
Diff
50 lines
1.7 KiB
Diff
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]);
|
|
}
|