mirror of https://github.com/ecmwf/eccodes.git
ECC-645: CRASH: BUFR encoding: setting a string key with integer value
This commit is contained in:
parent
601255e7f2
commit
8820be51bc
|
@ -1185,6 +1185,10 @@ static int encode_element(grib_context* c,grib_accessor_bufr_data_array* self,in
|
|||
return GRIB_INVALID_ARGUMENT;
|
||||
}
|
||||
idx=(int)self->numericValues->v[subsetIndex]->v[elementIndex]/1000-1;
|
||||
if (idx < 0 || idx >= self->stringValues->n) {
|
||||
grib_context_log(c,GRIB_LOG_ERROR,"encode_element: %s: Invalid index %d", bd->shortName, idx);
|
||||
return GRIB_INVALID_ARGUMENT;
|
||||
}
|
||||
err=encode_string_value(c,buff,pos,bd,self,self->stringValues->v[idx]->v[0]);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue