Skip to content

Commit

Permalink
Merge pull request #4992 from ChengJin01/bcv_stack_size_stakmap_static
Browse files Browse the repository at this point in the history
Check the stack size of a stackmap frame
  • Loading branch information
DanHeidinga authored Mar 13, 2019
2 parents 98f41b3 + 1416fa5 commit c82af85
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions runtime/bcverify/staticverify.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,12 @@ checkStackMap (J9CfrClassFile* classfile, J9CfrMethod * method, J9CfrAttributeCo
slotCount = 0;
if ((frameType >= CFR_STACKMAP_SAME_LOCALS_1_STACK) && (frameType <= CFR_STACKMAP_SAME_LOCALS_1_STACK_EXTENDED)) {
slotCount = 1;

/* The stackmap entry is invalid if the size of stack (1 slot) exceeds the size of the max stack.*/
if (code->maxStack < slotCount) {
errorCode = FATAL_CLASS_FORMAT_ERROR;
goto _failedCheck;
}
}
if (frameType >= CFR_STACKMAP_CHOP_3) {
slotCount = (IDATA) frameType - CFR_STACKMAP_APPEND_BASE;
Expand Down

0 comments on commit c82af85

Please sign in to comment.