mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
8027252: Crash in interpreter because get_unsigned_2_byte_index_at_bcp reads 4 bytes
Use 2-byte loads to load indexes from the byte code stream to avoid out of bounds reads. Reviewed-by: coleenp, sspitsyn
This commit is contained in:
parent
3e0a2a86bf
commit
0b4ed553d6
4 changed files with 14 additions and 6 deletions
|
@ -558,7 +558,7 @@ void TemplateTable::aload() {
|
|||
|
||||
|
||||
void TemplateTable::locals_index_wide(Register reg) {
|
||||
__ movl(reg, at_bcp(2));
|
||||
__ load_unsigned_short(reg, at_bcp(2));
|
||||
__ bswapl(reg);
|
||||
__ shrl(reg, 16);
|
||||
__ negptr(reg);
|
||||
|
@ -1552,7 +1552,11 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
|
|||
InvocationCounter::counter_offset();
|
||||
|
||||
// Load up EDX with the branch displacement
|
||||
__ movl(rdx, at_bcp(1));
|
||||
if (is_wide) {
|
||||
__ movl(rdx, at_bcp(1));
|
||||
} else {
|
||||
__ load_signed_short(rdx, at_bcp(1));
|
||||
}
|
||||
__ bswapl(rdx);
|
||||
if (!is_wide) __ sarl(rdx, 16);
|
||||
LP64_ONLY(__ movslq(rdx, rdx));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue