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

Severin Gehwolf sgehwolf at redhat.com
Thu Nov 28 13:13:25 UTC 2019


Hi Andrew,

Thanks for the review!

On Thu, 2019-11-28 at 01:44 +0000, Andrew John Hughes wrote:
> 
> 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.

Sure. Done:
http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8204290/02/webrev/

Thanks,
Severin



More information about the jdk8u-dev mailing list