Add DebugAssert calls to check array bound accesses

This commit is contained in:
Shahram Najm 2017-08-24 10:57:40 +01:00
parent 36dc5e38db
commit f073fa06d0
1 changed files with 2 additions and 0 deletions

View File

@ -541,9 +541,11 @@ static int value_count(grib_accessor* a,long* count)
type=get_native_type(a);
if (type==GRIB_TYPE_STRING) {
DebugAssert(self->index < self->numericValues->n);
idx=((int)self->numericValues->v[self->index]->v[0]/1000-1)/self->numberOfSubsets;
size=grib_sarray_used_size(self->stringValues->v[idx]);
} else {
DebugAssert(self->index < self->numericValues->n);
size=grib_darray_used_size(self->numericValues->v[self->index]);
}