Mercurial > hg > graal-compiler
changeset 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 | d91fecb90fc0 |
children | 657ff04a7b73 |
files | graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ArraySubstitutions.java |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
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(); }