From 5c23285a82a682c1c486aa006cf14186071ad83a Mon Sep 17 00:00:00 2001 From: rasbold Date: Mon, 7 Apr 2008 15:15:16 -0700 Subject: [PATCH] 6663908: NegativeArraySizeException is not thrown Summary: Don't optimize zero length array allocations at compile time. Reviewed-by: kvn, never --- src/share/vm/opto/parse3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/vm/opto/parse3.cpp b/src/share/vm/opto/parse3.cpp index d32053ce2..cfd042959 100644 --- a/src/share/vm/opto/parse3.cpp +++ b/src/share/vm/opto/parse3.cpp @@ -408,7 +408,7 @@ void Parse::do_multianewarray() { jint dim_con = find_int_con(length[j], -1); expand_fanout *= dim_con; expand_count += expand_fanout; // count the level-J sub-arrays - if (dim_con < 0 + if (dim_con <= 0 || dim_con > expand_limit || expand_count > expand_limit) { expand_count = 0; -- GitLab