# HG changeset patch # User shshahma # Date 1462982626 14400 # Node ID edbb67d8d46d5704249383c5fe218cc6e67a3777 # Parent 1e5be96d5c48163f580b9b187b92d4ed58737f6a 8155981: Bolster bytecode verification Reviewed-by: acorn, jdn Contributed-by: harold.seigel@oracle.com diff -r 1e5be96d5c48 -r edbb67d8d46d src/share/vm/classfile/verifier.cpp --- a/src/share/vm/classfile/verifier.cpp Fri Jul 08 15:06:04 2016 +0100 +++ b/src/share/vm/classfile/verifier.cpp Wed May 11 12:03:46 2016 -0400 @@ -1946,9 +1946,17 @@ case Bytecodes::_ifnonnull: target = bcs.dest(); if (visited_branches->contains(bci)) { - if (bci_stack->is_empty()) return true; - // Pop a bytecode starting offset and scan from there. - bcs.set_start(bci_stack->pop()); + if (bci_stack->is_empty()) { + if (handler_stack->is_empty()) { + return true; + } else { + // Parse the catch handlers for try blocks containing athrow. + bcs.set_start(handler_stack->pop()); + } + } else { + // Pop a bytecode starting offset and scan from there. + bcs.set_start(bci_stack->pop()); + } } else { if (target > bci) { // forward branch if (target >= code_length) return false; @@ -1971,9 +1979,17 @@ case Bytecodes::_goto_w: target = (opcode == Bytecodes::_goto ? bcs.dest() : bcs.dest_w()); if (visited_branches->contains(bci)) { - if (bci_stack->is_empty()) return true; - // Been here before, pop new starting offset from stack. - bcs.set_start(bci_stack->pop()); + if (bci_stack->is_empty()) { + if (handler_stack->is_empty()) { + return true; + } else { + // Parse the catch handlers for try blocks containing athrow. + bcs.set_start(handler_stack->pop()); + } + } else { + // Been here before, pop new starting offset from stack. + bcs.set_start(bci_stack->pop()); + } } else { if (target >= code_length) return false; // Continue scanning from the target onward.