Branch: Tag:

2016-02-23

2016-02-23 10:47:48 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Fixed NULL-dereference in handling of foreach.

Fixes [CID 1353483] and [CID 1353488].

3140:    "Argument 1 to foreach() is not always an array.");    }    -  if( lvalues->type->type == PIKE_T_AUTO ) -  { -  if(val_type) -  copy_pike_type( *val_type, expression->type->car ); -  } -  else -  { +     if (!lvalues) {    /* No loop variable. Will be converted to a counted loop    * by treeopt. */ -  +  } else if( lvalues->type->type == PIKE_T_AUTO ) { +  if(val_type) +  copy_pike_type( *val_type, expression->type->car );    } else if (pike_types_le(lvalues->type, void_type_string)) {    yyerror("Bad argument 2 to foreach().");    } else {
3165:    free_type(array_value_type);    }    } -  } +     free_type(array_zero);    }    }