diff options
author | Josh Stone <jistone@redhat.com> | 2009-06-09 17:04:40 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-06-09 17:04:40 -0700 |
commit | a8ec77194e89a8e685c7f44260be75a632254eaa (patch) | |
tree | 9bc3eeedcfe1c5a5339a687d37149ceb42690155 /tapsets.cxx | |
parent | 59d00eb0920ca89f67704e0f0bf0aa3074abb328 (diff) | |
download | systemtap-steved-a8ec77194e89a8e685c7f44260be75a632254eaa.tar.gz systemtap-steved-a8ec77194e89a8e685c7f44260be75a632254eaa.tar.xz systemtap-steved-a8ec77194e89a8e685c7f44260be75a632254eaa.zip |
Add bounds-checking to sdt $argN
Diffstat (limited to 'tapsets.cxx')
-rw-r--r-- | tapsets.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tapsets.cxx b/tapsets.cxx index 64657454..3ecf2250 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -3197,7 +3197,10 @@ struct sdt_var_expanding_visitor: public var_expanding_visitor sdt_var_expanding_visitor(string & process_name, string & probe_name, int arg_count, bool have_reg_args): process_name (process_name), probe_name (probe_name), - have_reg_args (have_reg_args), arg_count (arg_count) {} + have_reg_args (have_reg_args), arg_count (arg_count) + { + assert(!have_reg_args || (arg_count >= 0 && arg_count <= 10)); + } string & process_name; string & probe_name; bool have_reg_args; @@ -3221,13 +3224,14 @@ sdt_var_expanding_visitor::visit_target_symbol (target_symbol *e) provide(e); return; } - + + int argno = lex_cast<int>(e->base_name.substr(4)); + if (argno < 1 || argno > arg_count) + throw semantic_error ("invalid argument number", e->tok); + bool lvalue = is_active_lvalue(e); - string argname = e->base_name.substr(1); functioncall *fc = new functioncall; - int argno = lex_cast<int>(argname.substr(3)); - if (arg_count < 6) { fc->function = "ulong_arg"; |