summaryrefslogtreecommitdiffstats
path: root/dwflpp.cxx
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-10-16 18:32:12 -0700
committerJosh Stone <jistone@redhat.com>2009-10-21 09:08:07 -0700
commitebaa961812e7b29eee554025a6253d676cea6ce0 (patch)
tree06a133f40f59f458ce4cab472db6c6013a6988ec /dwflpp.cxx
parent730c3efceb4fcbb234a0fcdb0c0d299b8670fec6 (diff)
downloadsystemtap-steved-ebaa961812e7b29eee554025a6253d676cea6ce0.tar.gz
systemtap-steved-ebaa961812e7b29eee554025a6253d676cea6ce0.tar.xz
systemtap-steved-ebaa961812e7b29eee554025a6253d676cea6ce0.zip
Ensure that DWARF keeps loc2c to a reasonable stack depth
* dwflpp.cxx (dwflpp::express_as_string): Limit stack depth to 32.
Diffstat (limited to 'dwflpp.cxx')
-rw-r--r--dwflpp.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/dwflpp.cxx b/dwflpp.cxx
index b1d9a32b..0c45eb7d 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -2182,8 +2182,15 @@ dwflpp::express_as_string (string prelude,
fprintf(memstream, "{\n");
fprintf(memstream, "%s", prelude.c_str());
+
unsigned int stack_depth;
bool deref = c_emit_location (memstream, head, 1, &stack_depth);
+
+ // Ensure that DWARF keeps loc2c to a "reasonable" stack size
+ // 32 intptr_t leads to max 256 bytes on the stack
+ if (stack_depth > 32)
+ throw semantic_error("oversized DWARF stack");
+
fprintf(memstream, "%s", postlude.c_str());
fprintf(memstream, " goto out;\n");