Mercurial > hg > truffle
comparison src/share/vm/opto/parse3.cpp @ 7999:4fcf990aa34a
8006807: C2 crash due to out of bounds array access in Parse::do_multianewarray
Summary: check ndimensions before accessing length[i] element
Reviewed-by: kvn
Contributed-by: volker.simonis@gmail.com
author | drchase |
---|---|
date | Wed, 06 Feb 2013 11:33:49 -0800 |
parents | 2d6c433b1f38 |
children | 6f3fd5150b67 |
comparison
equal
deleted
inserted
replaced
7998:6a51fc70a15e | 7999:4fcf990aa34a |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
485 c = make_runtime_call(RC_NO_LEAF | RC_NO_IO, | 485 c = make_runtime_call(RC_NO_LEAF | RC_NO_IO, |
486 OptoRuntime::multianewarray_Type(ndimensions), | 486 OptoRuntime::multianewarray_Type(ndimensions), |
487 fun, NULL, TypeRawPtr::BOTTOM, | 487 fun, NULL, TypeRawPtr::BOTTOM, |
488 makecon(TypeKlassPtr::make(array_klass)), | 488 makecon(TypeKlassPtr::make(array_klass)), |
489 length[0], length[1], length[2], | 489 length[0], length[1], length[2], |
490 length[3], length[4]); | 490 (ndimensions > 2) ? length[3] : NULL, |
491 (ndimensions > 3) ? length[4] : NULL); | |
491 } else { | 492 } else { |
492 // Create a java array for dimension sizes | 493 // Create a java array for dimension sizes |
493 Node* dims = NULL; | 494 Node* dims = NULL; |
494 { PreserveReexecuteState preexecs(this); | 495 { PreserveReexecuteState preexecs(this); |
495 inc_sp(ndimensions); | 496 inc_sp(ndimensions); |