Browse Source

fix possible SIGSEGV on conversion

when converting byte and short values to larger values the conversion becomes
a simple copy opcode. The copy opcode however isn't included in the conversion
instrinsics array, causing an out of bounds read.
pull/17/head
Jakob Löw 5 years ago
parent
commit
e385fd1101
  1. 3
      jit/jit-insn.c

3
jit/jit-insn.c

@ -4236,7 +4236,8 @@ apply_conversion(jit_function_t func, int oper, jit_value_t value,
jit_type_t result_type) jit_type_t result_type)
{ {
/* Set the "may_throw" flag if the conversion may throw an exception */ /* Set the "may_throw" flag if the conversion may throw an exception */
if(convert_intrinsics[oper - 1].descr.ptr_result_type) if(oper < sizeof(convert_intrinsics) / sizeof(jit_convert_intrinsic_t)
&& convert_intrinsics[oper - 1].descr.ptr_result_type)
{ {
func->builder->may_throw = 1; func->builder->may_throw = 1;
} }

Loading…
Cancel
Save