8006807: C2 crash due to out of bounds array access in Parse::do_multianewarray

Check ndimensions before accessing length[i] element

Reviewed-by: kvn
This commit is contained in:
Volker Simonis 2013-02-06 11:33:49 -08:00 committed by David Chase
parent 014d9489bb
commit 285249963c

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -487,7 +487,8 @@ void Parse::do_multianewarray() {
fun, NULL, TypeRawPtr::BOTTOM, fun, NULL, TypeRawPtr::BOTTOM,
makecon(TypeKlassPtr::make(array_klass)), makecon(TypeKlassPtr::make(array_klass)),
length[0], length[1], length[2], length[0], length[1], length[2],
length[3], length[4]); (ndimensions > 2) ? length[3] : NULL,
(ndimensions > 3) ? length[4] : NULL);
} else { } else {
// Create a java array for dimension sizes // Create a java array for dimension sizes
Node* dims = NULL; Node* dims = NULL;