RFR 8223174 : Pattern.compile() can throw confusing NegativeArraySizeException

Ivan Gerasimov ivan.gerasimov at oracle.com
Sat May 4 00:53:44 UTC 2019


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