Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/interp_masm_x86_32.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 | 5ccbab1c69f3 |
children | d3f14809b051 32b682649973 |
comparison
equal
deleted
inserted
replaced
13002:1a04de1aaedb | 13034:ea79ab313e98 |
---|---|
194 } | 194 } |
195 | 195 |
196 | 196 |
197 void InterpreterMacroAssembler::get_unsigned_2_byte_index_at_bcp(Register reg, int bcp_offset) { | 197 void InterpreterMacroAssembler::get_unsigned_2_byte_index_at_bcp(Register reg, int bcp_offset) { |
198 assert(bcp_offset >= 0, "bcp is still pointing to start of bytecode"); | 198 assert(bcp_offset >= 0, "bcp is still pointing to start of bytecode"); |
199 movl(reg, Address(rsi, bcp_offset)); | 199 load_unsigned_short(reg, Address(rsi, bcp_offset)); |
200 bswapl(reg); | 200 bswapl(reg); |
201 shrl(reg, 16); | 201 shrl(reg, 16); |
202 } | 202 } |
203 | 203 |
204 | 204 |