1.1 --- a/src/share/vm/interpreter/bytecodeStream.cpp Wed Oct 22 20:47:00 2008 -0700 1.2 +++ b/src/share/vm/interpreter/bytecodeStream.cpp Thu Oct 30 15:48:59 2008 -0400 1.3 @@ -28,8 +28,9 @@ 1.4 Bytecodes::Code RawBytecodeStream::raw_next_special(Bytecodes::Code code) { 1.5 assert(!is_last_bytecode(), "should have been checked"); 1.6 // set next bytecode position 1.7 - address bcp = RawBytecodeStream::bcp(); 1.8 - int l = Bytecodes::raw_special_length_at(bcp); 1.9 + address bcp = RawBytecodeStream::bcp(); 1.10 + address end = method()->code_base() + end_bci(); 1.11 + int l = Bytecodes::raw_special_length_at(bcp, end); 1.12 if (l <= 0 || (_bci + l) > _end_bci) { 1.13 code = Bytecodes::_illegal; 1.14 } else { 1.15 @@ -39,8 +40,12 @@ 1.16 _is_wide = false; 1.17 // check for special (uncommon) cases 1.18 if (code == Bytecodes::_wide) { 1.19 - code = (Bytecodes::Code)bcp[1]; 1.20 - _is_wide = true; 1.21 + if (bcp + 1 >= end) { 1.22 + code = Bytecodes::_illegal; 1.23 + } else { 1.24 + code = (Bytecodes::Code)bcp[1]; 1.25 + _is_wide = true; 1.26 + } 1.27 } 1.28 } 1.29 _code = code;