Skip to content

Commit 350fb53

Browse files
committed
8282134: Certain regex can cause a JS trap in WebView
Backport-of: 7396396
1 parent e05362c commit 350fb53

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
@@ -423,4 +423,12 @@ public void onError() {
423423
throw new AssertionError(ex);
424424
}
425425
}
426+
427+
// JDK-8282134 Certain regex can cause a JS trap in WebView
428+
@Test public void jsRegexpTrapTest() {
429+
final String FILE = "src/test/resources/test/html/unicode.html";
430+
load(new File(FILE));
431+
WebEngine web = getEngine();
432+
assertTrue("Load task completed successfully", getLoadState() == SUCCEEDED);
433+
}
426434
}
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)