ECC-645: CRASH: BUFR encoding: setting a string key with integer value

This commit is contained in:
Shahram Najm 2018-03-06 17:40:48 +00:00
parent 601255e7f2
commit 8820be51bc
1 changed files with 4 additions and 0 deletions

View File

@ -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 {