mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
7020373: JSR rewriting can overflow memory address size variables
Abort if incoming classfile's parameters would cause overflows Reviewed-by: coleenp, dcubed, never
This commit is contained in:
parent
d5438d3e05
commit
222ac81222
2 changed files with 100 additions and 4 deletions
|
@ -963,10 +963,21 @@ void GenerateOopMap::init_basic_blocks() {
|
|||
// initialize the CellTypeState-related information.
|
||||
init_state();
|
||||
|
||||
// We allocate space for all state-vectors for all basicblocks in one huge chuck.
|
||||
// Then in the next part of the code, we set a pointer in each _basic_block that
|
||||
// points to each piece.
|
||||
CellTypeState *basicBlockState = NEW_RESOURCE_ARRAY(CellTypeState, bbNo * _state_len);
|
||||
// We allocate space for all state-vectors for all basicblocks in one huge
|
||||
// chunk. Then in the next part of the code, we set a pointer in each
|
||||
// _basic_block that points to each piece.
|
||||
|
||||
// The product of bbNo and _state_len can get large if there are lots of
|
||||
// basic blocks and stack/locals/monitors. Need to check to make sure
|
||||
// we don't overflow the capacity of a pointer.
|
||||
if ((unsigned)bbNo > UINTPTR_MAX / sizeof(CellTypeState) / _state_len) {
|
||||
report_error("The amount of memory required to analyze this method "
|
||||
"exceeds addressable range");
|
||||
return;
|
||||
}
|
||||
|
||||
CellTypeState *basicBlockState =
|
||||
NEW_RESOURCE_ARRAY(CellTypeState, bbNo * _state_len);
|
||||
memset(basicBlockState, 0, bbNo * _state_len * sizeof(CellTypeState));
|
||||
|
||||
// Make a pass over the basicblocks and assign their state vectors.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue