diff options
author | Adam Chlipala <adam@chlipala.net> | 2019-03-10 15:37:40 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2019-03-10 15:37:40 -0400 |
commit | 43666c47b550904e5573e28fab6ba9d2c51ddcd3 (patch) | |
tree | 068ddaa87a05640016f84023eb8ddcdb494df753 /lib/js | |
parent | c2833576dc32ec143c5f4180c7688962eeec5e05 (diff) |
JavaScript string subscripting should raise out-of-bounds exceptions
Diffstat (limited to 'lib/js')
-rw-r--r-- | lib/js/urweb.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 1c296fe1..749e5056 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -2493,6 +2493,8 @@ function id(x) { return x; } function sub(s, i) { var ch = undefined; iterateString(s, function(c, idx) { if (idx == i) { ch = c; return false; }}); + if (ch == undefined) + er("String index " + i + " out of bounds") return ch; } function suf(s, i) { |