Mercurial > hg > truffle
diff src/cpu/x86/vm/templateTable_x86_64.cpp @ 13034:ea79ab313e98
8027252: Crash in interpreter because get_unsigned_2_byte_index_at_bcp reads 4 bytes
Summary: Use 2-byte loads to load indexes from the byte code stream to avoid out of bounds reads.
Reviewed-by: coleenp, sspitsyn
author | mgerdin |
---|---|
date | Wed, 30 Oct 2013 15:35:25 +0100 |
parents | d13d7aba8c12 |
children | 42790b7e4d48 |
line wrap: on
line diff
--- a/src/cpu/x86/vm/templateTable_x86_64.cpp Mon Oct 28 21:41:48 2013 +0400 +++ b/src/cpu/x86/vm/templateTable_x86_64.cpp Wed Oct 30 15:35:25 2013 +0100 @@ -568,7 +568,7 @@ } 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); @@ -1575,7 +1575,11 @@ 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) {