Branch: Tag:

2013-02-05

2013-02-05 10:42:35 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler (amd64): Add some missing type checking to F_FOREACH.

The first argument to F_FOREACH wasn't verified to be an array,
which would cause core dumps if it wasn't.
Fixes [Pike-mailing-list 13472]/[LysLysKOM 20109625].

2076:    -1: counter    */    amd64_load_sp_reg(); +  mov_mem8_reg( sp_reg, -4*sizeof(struct svalue), REG_RBX ); +  cmp_reg32_imm( REG_RBX, PIKE_T_ARRAY ); +  jne(&label_D);    mov_mem_reg( sp_reg, -1*sizeof(struct svalue)+8, REG_RAX );    mov_mem_reg( sp_reg, -4*sizeof(struct svalue)+8, REG_RBX );    mov_mem32_reg( REG_RBX, OFFSETOF(array,size), REG_RCX );
2120:    amd64_call_c_function( assign_lvalue );    jmp(&label_B);    +  LABEL_D; +  /* Bad arg 1. Let the C opcode throw the error. */ +  amd64_call_c_opcode(instrs[off].address, flags); +  /* NOT_REACHED */ +     LABEL_A;    mov_imm_reg( 0, REG_RBX );    LABEL_B;