Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 3cfee27

Browse files
committed
8282134: Certain regex can cause a JS trap in WebView
Backport-of: 73963960dc6e56fe34d7aa5fb4ce6f6d2f07acc5
1 parent 6fe09f4 commit 3cfee27

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

modules/javafx.web/src/main/native/Source/JavaScriptCore/yarr/YarrJIT.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,7 @@ class YarrGenerator final : public YarrJITInfo, private MacroAssembler {
21352135

21362136
if (!nonGreedyFailuresDecrementIndex.empty()) {
21372137
nonGreedyFailuresDecrementIndex.link(this);
2138-
breakpoint();
2138+
sub32(TrustedImm32(1), index);
21392139
}
21402140
nonGreedyFailures.link(this);
21412141
sub32(countRegister, index);

modules/javafx.web/src/test/java/test/javafx/scene/web/LoadTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,4 +413,12 @@ public void onError() {
413413
throw new AssertionError(ex);
414414
}
415415
}
416+
417+
// JDK-8282134 Certain regex can cause a JS trap in WebView
418+
@Test public void jsRegexpTrapTest() {
419+
final String FILE = "src/test/resources/test/html/unicode.html";
420+
load(new File(FILE));
421+
WebEngine web = getEngine();
422+
assertTrue("Load task completed successfully", getLoadState() == SUCCEEDED);
423+
}
416424
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body>
4+
<script>
5+
let a = "\ud800\ud800\udc00"
6+
let b = /(.*[^x]+?)[^]*([1])/u
7+
b.exec(a)
8+
</script>
9+
10+
<p id="regtest">PASS</p>
11+
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)