aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsundar <none@none>2014-06-03 13:57:52 +0530
committersundar <none@none>2014-06-03 13:57:52 +0530
commit9632c562f98fcde891baffe603dd8f85a10e2e13 (patch)
tree0743f4028f71840755ec279ba50ccea16544ab9d /src
parent01f4856d53d38038f8f45523a6b1eb810d485b0c (diff)
downloadnashorn-9632c562f98fcde891baffe603dd8f85a10e2e13.tar.gz
8044612: StringIndexOutOfBoundException in NativeRegExp.appendReplacement
Reviewed-by: hannesw, lagergren
Diffstat (limited to 'src')
-rw-r--r--src/jdk/nashorn/internal/objects/NativeRegExp.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/jdk/nashorn/internal/objects/NativeRegExp.java b/src/jdk/nashorn/internal/objects/NativeRegExp.java
index 89a9a828..34657d25 100644
--- a/src/jdk/nashorn/internal/objects/NativeRegExp.java
+++ b/src/jdk/nashorn/internal/objects/NativeRegExp.java
@@ -731,6 +731,12 @@ public final class NativeRegExp extends ScriptObject {
if (nextChar == '$') {
// Skip past $
cursor++;
+ if (cursor == replacement.length()) {
+ // nothing after "$"
+ sb.append('$');
+ break;
+ }
+
nextChar = replacement.charAt(cursor);
final int firstDigit = nextChar - '0';