ECC-990: Crash: grib_copy -r on packingType of grid_second_order_general_grib1

This commit is contained in:
Shahram Najm 2019-09-12 12:55:00 +01:00
parent f94e4a9179
commit 59dea518b7
1 changed files with 20 additions and 18 deletions

View File

@ -183,23 +183,24 @@ static void init_class(grib_accessor_class* c)
static void init(grib_accessor* a,const long v, grib_arguments* args)
{
grib_accessor_data_g1second_order_general_packing *self =(grib_accessor_data_g1second_order_general_packing*)a;
grib_handle* hand = grib_handle_of_accessor(a);
self->half_byte = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->packingType = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->ieee_packing = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->precision = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->widthOfFirstOrderValues = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->N1 = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->N2 = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->numberOfGroups = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->numberOfSecondOrderPackedValues = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->extraValues = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->Ni = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->Nj = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->pl = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->jPointsAreConsecutive = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->bitmap = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->groupWidths = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
self->half_byte = grib_arguments_get_name(hand,args,self->carg++);
self->packingType = grib_arguments_get_name(hand,args,self->carg++);
self->ieee_packing = grib_arguments_get_name(hand,args,self->carg++);
self->precision = grib_arguments_get_name(hand,args,self->carg++);
self->widthOfFirstOrderValues = grib_arguments_get_name(hand,args,self->carg++);
self->N1 = grib_arguments_get_name(hand,args,self->carg++);
self->N2 = grib_arguments_get_name(hand,args,self->carg++);
self->numberOfGroups = grib_arguments_get_name(hand,args,self->carg++);
self->numberOfSecondOrderPackedValues = grib_arguments_get_name(hand,args,self->carg++);
self->extraValues = grib_arguments_get_name(hand,args,self->carg++);
self->Ni = grib_arguments_get_name(hand,args,self->carg++);
self->Nj = grib_arguments_get_name(hand,args,self->carg++);
self->pl = grib_arguments_get_name(hand,args,self->carg++);
self->jPointsAreConsecutive = grib_arguments_get_name(hand,args,self->carg++);
self->bitmap = grib_arguments_get_name(hand,args,self->carg++);
self->groupWidths = grib_arguments_get_name(hand,args,self->carg++);
self->edition=1;
a->flags |= GRIB_ACCESSOR_FLAG_DATA;
}
@ -317,9 +318,10 @@ static int pack_double(grib_accessor* a, const double* cval, size_t *len)
int err = 0;
char type[]="grid_second_order";
size_t size=strlen(type);
grib_handle* hand = grib_handle_of_accessor(a);
err = grib_set_string(grib_handle_of_accessor(a),"packingType",type,&size);
err = grib_set_string(hand,"packingType",type,&size);
if (err) return err;
return grib_set_double_array(grib_handle_of_accessor(a),"values",cval,*len);
return grib_set_double_array(hand,"values",cval,*len);
}