Chromium Code Reviews| Index: src/string.js |
| diff --git a/src/string.js b/src/string.js |
| index da9ba6acb89893d0e7f070359f10912db5db5f47..1a13d16428a2dbb961578b978566ff44edf49738 100644 |
| --- a/src/string.js |
| +++ b/src/string.js |
| @@ -340,6 +340,7 @@ function ApplyReplacementFunction(replace, captures, subject) { |
| } |
| if (index < 0) index = 0; |
| if (index > str.length) index = str.length; |
| + if (searchStr.length + index > str.length) return -1; |
| return %StringIndexOf(str, searchStr, index); |
| }, DONT_ENUM); |