diff options
author | eteo <eteo> | 2006-04-23 11:05:00 +0000 |
---|---|---|
committer | eteo <eteo> | 2006-04-23 11:05:00 +0000 |
commit | 2288c6bb3f8ad1972315d98d8271ae9fbf391cde (patch) | |
tree | 718f2e6cf361960ea6e8c0667edd3fc83fb26237 /translate.cxx | |
parent | 83a89572bebe11ba5d11db01b1ded66560a4b8f7 (diff) | |
download | systemtap-steved-2288c6bb3f8ad1972315d98d8271ae9fbf391cde.tar.gz systemtap-steved-2288c6bb3f8ad1972315d98d8271ae9fbf391cde.tar.xz systemtap-steved-2288c6bb3f8ad1972315d98d8271ae9fbf391cde.zip |
2006-04-23 Eugene Teo <eteo@redhat.com>
PR 2149
* translate.cxx (mapvar::set): Test _stp_map_set_xx() for
array overflows.
Diffstat (limited to 'translate.cxx')
-rw-r--r-- | translate.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/translate.cxx b/translate.cxx index 83d6dd93..f3a5b23d 100644 --- a/translate.cxx +++ b/translate.cxx @@ -581,14 +581,20 @@ struct mapvar string set (vector<tmpvar> const & indices, tmpvar const & val) const { + string res = "{ int rc = "; + // impedance matching: empty strings -> NULL if (type() == pe_string) - return (call_prefix("set", indices) + res += (call_prefix("set", indices) + ", (" + val.qname() + "[0] ? " + val.qname() + " : NULL))"); else if (type() == pe_long) - return (call_prefix("set", indices) + ", " + val.qname() + ")"); + res += (call_prefix("set", indices) + ", " + val.qname() + ")"); else throw semantic_error("setting a value of an unsupported map type"); + + res += "; if (unlikely(rc)) c->last_error = \"Array overflow, check MAXMAPENTRIES\"; }"; + + return res; } string hist() const |