mirror of https://github.com/ecmwf/eccodes.git
Add DebugAssert calls to check array bound accesses
This commit is contained in:
parent
36dc5e38db
commit
f073fa06d0
|
@ -541,9 +541,11 @@ static int value_count(grib_accessor* a,long* count)
|
||||||
type=get_native_type(a);
|
type=get_native_type(a);
|
||||||
|
|
||||||
if (type==GRIB_TYPE_STRING) {
|
if (type==GRIB_TYPE_STRING) {
|
||||||
|
DebugAssert(self->index < self->numericValues->n);
|
||||||
idx=((int)self->numericValues->v[self->index]->v[0]/1000-1)/self->numberOfSubsets;
|
idx=((int)self->numericValues->v[self->index]->v[0]/1000-1)/self->numberOfSubsets;
|
||||||
size=grib_sarray_used_size(self->stringValues->v[idx]);
|
size=grib_sarray_used_size(self->stringValues->v[idx]);
|
||||||
} else {
|
} else {
|
||||||
|
DebugAssert(self->index < self->numericValues->n);
|
||||||
size=grib_darray_used_size(self->numericValues->v[self->index]);
|
size=grib_darray_used_size(self->numericValues->v[self->index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue