[8u] RFR: 8204290: Add check to limit number of capture groups

Andrew John Hughes gnu.andrew at redhat.com
Thu Nov 28 01:44:20 UTC 2019



On 18/11/2019 18:11, Severin Gehwolf wrote:
> Hi,
> 
> Could I please get a review of this OpenJDK 8u backport of JDK-8204290
> for Oracle JDK 8u24x parity? The JDK 11 patch is the same exept for
> these test changes (and modulo path changes):
> 
> This:
> 
>     new RegExp("()".repeat(0x8001));
>     fail("Expected exception");
> 
> became:
> 
>     var captureGroups = "";
>     for (i=0; i < 0x8001; i++) { captureGroups = captureGroups + "()"; }
>     new RegExp(captureGroups);
>     fail("Expected exception");
> 
> String.repeat() is a JDK 11 feature. Results in:
> 
> <shell>:1 TypeError: "()".repeat is not a function
> 
> Bug: https://bugs.openjdk.java.net/browse/JDK-8204290
> webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8204290/01/webrev/
> 
> Testing: nashorn tests. New regresstion test passes. Manual testing with jjs.
> 
> Thoughts?
> 
> Thanks,
> Severin
> 

Could '+=' not be used here i.e.

for (i=0; i < 0x8001; i++) { captureGroups += "()"; }

Otherwise looks good.

Thanks,
-- 
Andrew :)

Senior Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04  C5A0 CFDA 0F9B 3596 4222
https://keybase.io/gnu_andrew



More information about the jdk8u-dev mailing list