Mercurial > hg > truffle
diff graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ArraySubstitutions.java @ 16382:67500ef4d102
Check for negative array size in Array.newInstance
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Tue, 01 Jul 2014 12:37:14 -0700 |
parents | cc76575f485c |
children | 14e703edb2ab |
line wrap: on
line diff
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ArraySubstitutions.java Tue Jul 01 12:36:51 2014 -0700 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ArraySubstitutions.java Tue Jul 01 12:37:14 2014 -0700 @@ -36,6 +36,9 @@ public static Object newInstance(Class<?> componentType, int length) throws NegativeArraySizeException { // The error cases must be handled here since DynamicNewArrayNode can only deoptimize the // caller in response to exceptions. + if (length < 0) { + throw new NegativeArraySizeException(); + } if (componentType == void.class) { throw new IllegalArgumentException(); }