RFR 8223174 : Pattern.compile() can throw confusing NegativeArraySizeException
Martin Buchholz
martinrb at google.com
Sat May 4 01:05:13 UTC 2019
Test should check that Pattern.compile does not return normally, e.g. by
throwing AssertionError. Otherwise LGTM.
On Fri, May 3, 2019 at 5:54 PM Ivan Gerasimov <ivan.gerasimov at oracle.com>
wrote:
> Hello!
>
> A private method Pattern. RemoveQEQuoting() contains calculation of an
> array size, which can result in numeric overflow, and cause a confusing
> NegativeArraySizeException.
>
> Would you please help review the fix?
>
> Please note, that expressions `j + 2` and `pLen - i` cannot overflow
> (because j is the index of a substring "\Q", and i is an index < pLen),
> so they are not wrapped with exactXXX() methods.
>
> BUGURL: https://bugs.openjdk.java.net/browse/JDK-8223174
> WEBREV: http://cr.openjdk.java.net/~igerasim/8223174/00/webrev/
>
> --
> With kind regards,
> Ivan Gerasimov
>
>
More information about the core-libs-dev
mailing list