ECC-586: CRASH: extracting nonexistent BUFR subset with doExtractSubsets

This commit is contained in:
Shahram Najm 2017-11-13 18:02:45 +00:00
parent c704e61ec4
commit 2fc6263389
1 changed files with 4 additions and 0 deletions

View File

@ -1171,6 +1171,10 @@ static int encode_element(grib_context* c,grib_accessor_bufr_data_array* self,in
idx=((int)self->numericValues->v[elementIndex]->v[0]/1000-1)/self->numberOfSubsets;
err=encode_string_array(c,buff,pos,bd,self,self->stringValues->v[idx]);
} else {
if (self->numericValues->v[subsetIndex] == NULL) {
grib_context_log(c,GRIB_LOG_ERROR,"Invalid subset index %d (number of subsets=%ld)", subsetIndex, self->numberOfSubsets);
return GRIB_INVALID_ARGUMENT;
}
idx=(int)self->numericValues->v[subsetIndex]->v[elementIndex]/1000-1;
err=encode_string_value(c,buff,pos,bd,self,self->stringValues->v[idx]->v[0]);
}